VCV Prototype

Great module, thanks Andrew. The ‘LED’ display looks good for three lines of text, how do I output text to lines two & three?

having built one of those with duktape myself: https://github.com/jerrysievert/prototools might I highly recommend using quickjs instead? its overhead moving between c++ and javascript is much lower, and it’s a little faster on the interpreter side.

My $120 Thinkpad runs it fine with 50% CPU. Are Macbooks really that bad?

You can’t at this time.

How does it compare with V8?

depends on exactly what you’re doing with it:

  • startup (creating a context) - quickjs is faster
  • moving between c++ and javascript, quickjs is faster
  • execution-wise v8 is faster across the board, unless running --jitless in which quickjs beats it in crypto (see QuickJS Benchmark)
  • memory footprint, quickjs is less than 1mb when v8 is >25mb
  • compilation time, quickjs is 1-2 minutes, v8 is 30-45 minutes
  • disk utilization, 1-2mb compared to 1-2gb for maintenance
  • quickjs’s abi hasn’t changed drastically between versions (yet), so the cognitive time is lower

so, choose your poison, you can probably build a matrix off of that.

(full disclosure, I maintain a popular package that embeds v8)

My day job involves embedded V8 :wink:

so you share some of my hell :slight_smile: mine’s plv8, the javascript language extension for postgres.

looking at bench, without jit nonono, we need jit

I have released VCV Prototype 1.1.0.
Changelog at https://github.com/VCVRack/VCV-Prototype/blob/master/CHANGELOG.md.

The script API has changed slightly to allow buffering and use ArrayBuffers, which improves JavaScript performance ~5x, so read the changelog if you have begun writing scripts.

If you want, write QuickJsEngine.cpp and I’ll merge it and replace Duktape. It should be about 200 lines of code and translate nearly line-for-line from DuktapeEngine.cpp.

Hi Andrew

Thanks for this prototyping module

I should be interested about using Julia in it, juliadsp should be the golden state of art

thx

I’m glad someone is interested in a Julia scripting engine. If I get around to adding it, I’ll include JuliaDSP. Same with Python + SciPy.

2 Likes

I’ll get a PR in to you in a day or so … have it partway done but need to move to another task.

2 Likes

Feature request: Can we have the ability to drag-and-drop the .js files onto the module?

1 Like

Or reload automatically on update?

Another tiny feature request: can you add a hotkey for “Reload script”?

3 Likes

How do I zero an array? array.fill(0) produces TypeError: undefined not callable (property ‘fill’ of [object Float64Array])

Disclaimer: Many years since I wrote code, forgive me if I’m being an idiot.

Float32Array.fill was introduced in ES2015, but Duktape only supports up to ES2009. When @jerrysv sends his QuickJS engine which supports ES2020, it should work.
For now, I guess you could just set 0 in a for-loop, or with Float32Array.set([0, 0, ...]).

1 Like

Hi,

First I have to say that I was waiting for module to prototype for a while and I’m very happy with PROTOTYPE . Implementing a simple note keeping clamper I was surprised that performance of the result was quite good. Taking care to not do anything not needed because nothing relevant changed on input helps a lot.

While building my small prototype I stumbled over the following issues:

  1. How to set the value of a knob ?
    block.knobs[0] = 0.42 doesn’t seem to work.
  2. Is there a ‘initialize’ hook I can implement to be called when the user selects initialize from the right click menu ?
  3. Screen width in characters is 1 char to small.
    having 6 elements for knobs, switches, … it would be nice to have them labeled in the display. The display currently displays 34 characters per line. having 5 chars per column with 1 space in between would need 35 characters. There is space to the left so 35 should be possible.
  4. The display shows the name of the script. Maybe this real estate could be better used for two more lines of display available.
  5. To prototype something like a quantizer more knobs/switches are needed. An extension module giving more switches and knobs
    would be fine.
  6. Polyphonic IN and OUT also would be great and might be able to make issue 5 obsolete.

Regards
Dieter

This will be possible in Prototype 1.1.1.

I’ve made Initialize (Ctrl-I) do this in 1.1.1.

You can use console.log() to print to the console (if launching Rack from a console) or log.txt.

For other more advanced features, consider writing a C++ plugin.

Hi Andrew,
thx for your quick answer.
I’ll wait for 1.1.1 and will check it out when available.
Regarding screen with, console.log is nice but doesn’t solve my issue.
Is also a very minor one. Its just that it helps to label knobs and switches. If the display would just be one char wider, there would be 5 chars spaced by one space available for all 6 columns.
What about polyphony ?