VCV Prototype

@Vortico would it be feasible to add MIDI access to the Prototype API?

Eurorack and VCV modules use CV and gate, not MIDI.

Hi,
Since switchLights are used to set state, it would be nice if the colors of the Lights would be restored when reloading like the knob settings.
For example if you use a switchLight for an on/off (red/green) then it would be nice if the module would remember the current setting.
Regards
Dieter

Iā€™m not a dev, just another potential geek who loves the concept of Prototype and would be an avid user provided the bar is set suitably low.

That disclaimer out of the way: I came to rack from dablling in pure data, tidal cycles and foxdot -the last two being essentially respectively haskell and python interfaces for supercollider. Those two languages do lend themselves to structure music, not sure about their DSP capabilities. (:

Iā€™d love to see some sort of interface between vcv and foremost pure data and/or supercollider, though writing stuff in supercollider directly for me was super-atrocious. Itā€™s just too mature and capable to ignore. If those two were implemented Iā€™d be all over that module. (: After reading @gc3 s post about Faust I checked out some docs and examples, and yah, I could get behind that too, my noob brain felt at ease with its syntax and paradigms. (:

So from a lowly user perspective: +1 for pure data, supercollider, python and Faust. If I could load scripts from those languages into Prototype without much fuss that would be gold. +1 for decent documentation on that thing too. (;

1 Like

I agree those seem to be the most important future script engines for Prototype.

I might next add filesystem watching to automatically reload the script when the file is changed. This would allow you to ā€œlive codeā€ using VCV Rack, which could be used for a live show.

10 Likes

I initially suggested reload on update but having thought further, could we have a reload if changed trigger input? That way we could force a reload at say the beginning of the next bar (or other event) if the script timestamp has changed.

Just use a trigger detector in your script for that.

I probably wonā€™t add a Python engine due to the difficulty of embedding Python into an application.

  • Handling multiple interpreter contexts being called from arbitrary threads is not a well-supported use-case of Python, and the Global Interpreter Lock is an imperfect, sparsely-documented, and complex solution.
  • Python shared objects such as the math.cpython*.so module call libpython functions, but Rack dlopen()s plugins with RTLD_LOCAL, so the module canā€™t find the libpython symbols. This might be worked around, but it would be a nasty solution. This issue has been discovered by many, such as https://bugs.python.org/issue4434 and https://bugs.python.org/issue36753.
  • If Numpy and Scipy were included, the package would be ~100MB larger and 10,000+ files.

Regardless, Iā€™ve added PythonEngine.cpp to the repo in case anyone wants to pick up the work. It might even be easier to add Julia, which would also be a mess.

2 Likes

Iā€™ve been a Python programmer for over 20 years. I love Python. I applaud your choice here though; Python is good at a lot of things, but not everything, and itā€™s not a good fit here.

1 Like

Python/Scipy would be a good fit for script writers, but CPython is not designed to be embedded. The ability was added as an afterthought so itā€™s priority #10000 for the project, not #1 like Duktape or QuickJS.

I agree, Python the language would be nice, but as you indicate, the CPython implementation canā€™t play well here. Iā€™m looking forward to learning something new anyway :slight_smile:

Is there a tutorial for JavaScript that is specific to VCV Prototype? Some more sample code would be nice as well.
I want to use it to replace the arcane arrangements of adders, comparators and Frank Buss Formulas that I used here: https://youtu.be/KyBrSXecYmE?t=4289 (I linked to the end of that piece because the rest of the video only shows a small amount of the patch)
Thanks.

while not a tutorial, the README has a well documented simple script that shows all of the variables available and how to access them:

I wrote some for a project similar to VCV-Prototype a while back, Iā€™ll see about getting them ported. you might find VCV Prototype: Share your prototypes interesting, as others have been sharing what theyā€™ve come up with.

1 Like

Iā€™ve started working with prototype and for the most part itā€™s going okay. There are certain workflow issues that I need to sort out (Iā€™m using notepad to code with and thatā€™s not great) and the familiar sensation of dealing with bugs (ā€œwait, what? Why isnā€™t that workingā€) is returning to me.
One thing that doesnā€™t appear to be explained in the docs is the bufferindex parameter. In fact, iā€™m not really clear on what ā€œbuffersā€ are for in this context?
Other than that iā€™ve replaced about three rows of modules with one module and itā€™s looking okay so far.

If you can stand a new tool, Visual Studio Code (free, of course) will be a much better editor for JS. You wonā€™t have to learn many/any features to just start using it.

2 Likes

process() is called every N samples, where N is set by config.bufferSize and read from block.bufferSize. It stores the last N samples received in the array block.inputs[i], and your goal is to fill the array block.outputs[i]. Buffers are easier to work with and better performance than sample-by-sample state.

1 Like

Added the Lua script engine. Will be available in the next Prototype release.

8 Likes

I think what I want is just a fairly simple text editor that has auto indent and syntax highlighting. Iā€™m somewhat ā€œold schoolā€.
Anyway, all the stuff that I did with Formulas, adders and comparitors (amoungst other stuff) Iā€™m doing with Prototype and it works okay. Problems?

  • Please let me send several separate lines of text to the display.
  • Iā€™m tempted to ask for polyphonic ports but Iā€™m not sure how that would work. Howeverā€¦
  • Please can we have either more ports or a simple extension module that gives you another 6 sets of things and lets you keep adding more extensions. The problem being that there is no amount of ports that is ā€œenoughā€.
  • Minor thing: I was expecting the buttons to be slightly simpler to use. Like, theyā€™d toggle on and off and give me a true or false value.

Thanks

7 posts were split to a new topic: Text editors

Isolated sub-interpretes in embedded python can be challenging ā€¦ I also had a look at https://pybind11.readthedocs.io/en/stable/advanced/embedding.html Maybe its easier embedding with CFFI https://cffi.readthedocs.io/en/latest/embedding.html Iā€™ll have a look at it. Iā€™m a little bit rusty with C++ ā€¦but Iā€™ll get along.