Sonic-Pi with VCV-Rack

On Linux I’m using Jack as my audio server, which lets me do cool stuff between VCV Rack and Sonic Pi.

First cool thing, I can send audio back and forth easily. I use the skJack modules on VCV Rack, which let me add jack inputs or outpts in Rack. Then I can use the following snippet in Sonic Pi to use Rack as an FX.

def with_external_fx(name, outport, inport: outport, mix: 1)
  with_fx :level, amp: mix do
    live_audio name, input: inport
  end
  with_fx :sound_out, output: outport, amp: (1 - mix) do
    yield
  end
end

I’ve had limited success so far using OSC. The trowasoft modules have a CV -> OSC -> CV module. I’ve been able to use it to send a cue from VCV Rack to Sonic-Pi, but only one, as all events seem to arrive at /osc:127.0.0.1:44578/#bundle without an actual value, only a trigger (and the port changes every time).

Sending OSC from Sonic Pi to VCV Rack works better. You need to set the trowasoft module to use an empty namespace in the config tab. Then just use_osc "127.0.0.1" 7001 then you can do things like osc "/ch/1", 4.2 and in the trowasoft module you’ll get a trigger signal and the corresponding port will output 4.2V. I haven’t used this much as MIDI is good enough for me.

Another useful trick: I map my MIDI ports from Alsa to Jack using a2jmidi. I’ve also added more MIDI-through ports (but using multiple channels works just as well) using this trick. I found that I need to be disciplined about always specifying port and channel on any MIDI instruction in Sonic Pi or I just start getting really weird behaviors with some of my instruments :slight_smile:

Overall it’s a lot of fun to use both at the same time. I enjoy the expressivity of Rack when it comes to fine-tuning the sound more than tweaking numbers in Sonic Pi and waiting for the next live_loop to occur so I can hear what I changed. But I enjoy the power of Sonic-Pi as a very advanced sequencer and sample player that I can feed into Rack, because these aspects can be a bit limiting in a purely modular world.