I’ve been reasoning about some RPC for modules since I started to use rack but never got back to have a look at the source code. Today I sat down and implemented the basic functionality of my python midi codec with a patch, where I showcase how I script 2 modules … (Plateau and ADDR-Seq) by entering python commands in a Jupyter Notebook. On mac and linux the setup and code is a little bit easier, as you can create virtual ports by code, on windows I had to use loopMIDI which is easy enough to setup. So for this I created a loopback device called VCVScript.
The idea is: I created an automatic mapping with midi-cat, created a list of the same order with python compatible names.
plateau_controls = [
"dry_level",
"wet_level",
"pre_delay",
"input_low_cut",
"input_high_cut",
"size",
"diffusion",
"decay",
"reverb_high_cut",
"reverb_low_cut",
"modulation_rate",
"modulation_shape",
"modulation_depth",
"freeze",
"clear",
"freeze_toggle",
"nr_17",
"dry_cv_depth",
"wet_cv_depth",
"input_low_cut_cv",
"input_high_cut_cv",
"size_cv",
"diffusion_cv",
"decay_cv",
"reverb_high_cut_cv",
"reverb_low_cut_cv",
"mod_speed_cv",
"mod_shape_cv",
"mod_depth_cv",
"tuned_mode",
"diffuse_input",
]
addr_seq_controls = [
"stesp",
"direction",
"select_step",
"step_1",
"step_2",
"step_3",
"step_4",
"step_5",
"step_6",
"step_7",
"step_8",
]
Could also have been using the label function of midi_cat and reading the labels from the json.
Next step then saved this as preset and loaded the json in the python script, automatically generated midi cc’s and been writing it back. Then loading the preset in rack again. With this setup I have a proper mapping.
No the idea … I want to gey some mechanism, where I can address every module and its items. midi is always possible, but requires manual mapping all the time. My idea is more like how can we automate this.
One idea which I also posted in another thread is to have something like OSC … an publish subscribe like lightweight thing lik zeromq, or nanomsg nng. I also wouldn’t mind using mqtt for this and running a broker on my machine. But I’d rather prefere a highspeed low latency solution.
And now the question to @stoermelder or @Vortico
Is it possible to enumerate all existing modules in rack and get their parameter names? Like it already is done in midi-map or cat.
This way I would have a server module in rack that enumerates all the modules and I’d implement the client side in my python script (or other app like touch osc) where I then could address a module by its canonical name like
/plateau/<moduleId or instance number>/pre_delay
I had a reason remote code implemented with a sysex codec to be able to adress all modules in parallel within a script. But I don’t think we need that in rack, also it might would be nice. But for this solution I’d rather have some conventional setup, where I can discover the modules automatically (get a response from the module server with the available controller item names and then could autogenerate class in python. Then I get autocompletion and can easily script stuff like custom randomization, which I did in this example and assigned a midi send on the big button. The script receives the midi message and then executes the randomization over midi.