Would it be Possible to Manipulate VCV Rack using Python Script?

Hi all,

Just wondering if it is possible to control the VCV rack application using a python script. Similar to using pywin32 with a COM interface.

I would like to be able to get a list of all the current modules in my rack from the application object and manipulate knobs using a remote script.

Probably not possible but thought I would ask.

Thanks

1 Like

Check out this thread and the linked github repo:

@jerrysv created an HTTP server that runs in Rack. To accomplish your goal, you would have to create all the necessary Rack functionality as a Rack plugin written in C++ (list all modules, manipulate knobs, etc), hook them up to an HTTP API running a server similar to described above, and then you could interface with your HTTP server from any other sort of application.

1 Like

Welcome @smithjb84! The good news abt @computerscare 's solution is that inter-process communication is the hard part, and that’s handled over HTTP in this proposal. The Rack API is wide open and very easy to use, so the internal stuff should cause you no trouble (check out the @stoermelder modules, among others, for excellent introspection and reflection code examples).

COM-type control isn’t possible, by the way, because Rack (for very good reasons) handles its own plugin controls rather than creating system GUI controls–it’s more like a video game than a typical application in that respect (and some others).

2 Likes

Thanks for the replies :slightly_smiling_face: I will be sure to check out your recommendations.

My idea was to make an arduino controller that had access to each module that I added to rack. The controller would have one knob that you use to scroll through each of the modules and then a few other knobs to control say the first 4 knobs of the selected module. I thought this could be possible by creating a module that opens up a serial connection to my arduino then has access to the rest of rack to achieve the control through the API. Unfortunately my C++ knowledge is pretty lacking and I’m probably trying to run before I can walk.

2 Likes

My MIDI-CAT module using the MEM expander can do petty much what you are describing, but using MIDI (which is just a serial protocol).

1 Like

This sounds like an awesome idea, and I think it would actually be a pretty good way to learn C++ in the context of Rack plugins.

There are lots of REALLY good open source code examples for Rack plugins, the Rack API is simple and extremely well-thought-out, and the community here tends to be pretty helpful :slight_smile:

One killer feature for such a controller, which you may well have already thought of, would be to bind the module ID to a viewport position and (optionally) zoom and center on the module you’re controlling when you turn the selector. Here’s a plugin that uses that API (there are others):

I have a feature request to the Faderfox dev out for the EC4 that would allow this, but haven’t heard anything from him in a while…

1 Like

Didn’t even think of the zoom idea but that sounds like it would be really useful. Eventually I would like to incorporate a screen with the Arduino that shows which module you are controlling and gives feedback for each of the parameter knobs. One step at a time though :laughing:

Hey thanks for this. Will check it out and have a look through the source code to see if I can start to wrap my head around things

I’d take a serious look at Trowa’s cvOSCcv. I suspect (I’m not a pythonista) there are libraries for OSC and the necessary networking for Python.

Arduino has a built in MIDI library. An OSC API was developed at CNMAT Berkeley (same institute where OSC was originally developed).

Best way to go about it would likely be using Teensyduino for programming, as Teensy is intended exactly for applications like this & Arduino libraries to write the code. Unless you want to make your own VCV Module… just go for MIDI and use MIDI-Cat. Programming the Teensy and soldering Buttons & Knobs on a breadboard is no biggie.

What I don’t understand is what Python has to do with it? Arduino and VCV are both C++ as far as I know. Just add controls to the analog ports of a teensy, call and read those ports in a loop and return their value - then use the MIDI library to bind each port to a different MIDI CC address, convert its value to 0-127. Set up as MIDI interface and send input on all channels. Now when connecting your Teensy via USB, your PC should autom. recognise it as a MIDI device.

What really warrants some extensive research here is finding the right knobs. Saying this as one amateur to the other: the code is 95% copy+paste, the soldering (unless you want more than buttons and knobs) is beginner level and prototyping can be set up in a matter of minutes on a solderless breadboard. If your knobs are shit though… you’ll regret it.

Have not used Teensy, but there is ProMicro clones(2$ on aliexpress) they have AVR chip with USB, also there is STM32F103 ‘Bluepill’ (3$ on aliexpress) or ESP32 board (5$ on aliexpress) with WIFI and Bluetooth, these cheaper and beefy than AVR Tennsy, but they still can achieve USB-MIDI with some work, you still can use Arduino framework, in addition on ESP32 you can do MIDI over Bluetooth or MIDI over WiFi or use MicroPython instead of Arduino framework.

The MidiCAT module goes most of the way to what I want to achieve but will only be able to transmit and receive midi data between the software and the controller. I am hoping to also be able to transmit names of the modules / parameters etc to display on a screen. This will involve creating a module that will have access to the API and will also be capable of opening up a serial connection between the Arduino and software to transmit and receive data.

I have made a couple of midi controllers using Arduino and there are some nice libraries that I am familiar with.

The reason for mentioning Python was I was hoping I could use python to hook the rack process and use python to access the rack API instead of a module. This is just because I am more familiar with Python. Looks like I will have to create a module though. Well at least its a good excuse to learn a new language.

Always amazed at how little these boards cost. I have a ESP32 board for wifi stuff which cost me £2 off aliexpress.

Got a Arduino Mega on order which cost £5 and has 54 digital in/outs and 16 analogue.

1 Like

Managed to get a proof of principle version wired up and working.

The VCV module establishes a serial connection over USB to the Arduino and allows the transfer of data using serialized JSON. On connection the module sends the Arduino information on all the modules currently in your rack along with parameters for each of the modules. You can then select a module from the list on the Arduino and currently control the first 6 parameters of the module. There is no mapping involved.

Very much a work in progress at the moment and just have one potentiometer hooked up at the moment. Got some better quality pots on order along with some better knobs. Hopefully when these are hard wired it should eliminate some of the jitter.

My next steps are to add the following additional functionality…

  • Value takeover for potentiometer control to stop values jumping when changing between modules
  • Parameter selection so that the parameter can be chosen from a list for each of the knobs and saved along with the project
  • Get everything mounted. Think I will add a small button by each knob to access the parameter selection menu
8 Likes

Wow!

MIDI-CAT has a permanent home in my default template.