Sonic-Pi with VCV-Rack

Hey everyone!

I don’t know if you already have tried to do that, but using Sonic-Pi with VCV Rack is definitely a very funny thing to do and it’s really easy to setup. VCV Rack is a bit ressource hungry, but things should be better in a few months. Here is a very simple patch I made: a duophonic synthesizer with two reverb modules.

live_loop :VCV do ; tick
  midi (scale [:a3, :a4].choose, :major_pentatonic, num_octaves: 2).look,
channel: 1, port: "IAC MIDI Bus 1", vel: 120
  midi_cc 0, (line [40, 50].choose, 90, steps: 5).mirror.look,
channel: 1, port: "IAC MIDI Bus 1"
  sleep (ring 0.25).look
end

So far I still have problems to handle polyphony and note trigger properly. Tell me if you found a solution to easily play polyphonic textures, harmonies and counterpoints. There is a few MIDI Modules like MIDI-1, 4 or MIDI-CC to receive and parse the informations coming from Sonic-Pi.

Share your patches if you feel like it! It’s a magnificent sound-synthesis engine to use along with the sampling capacities of Sonic-Pi.

EDIT : oh, and it’s free, and partly open-source.

4 Likes

What a great idea! If I can ever get Sonic Pi to run on my Windows 10 machine this is something I will try. Will give it a shot in MAX too.

1 Like

Hey @Paul - welcome to our community! Have a big hug from all of us :slight_smile:

1 Like

Awesome! What’s most exciting to me is that pretty much all of this should be portable to SuperCollider, so if there’s anything truly amazing do let us know and we can start porting stuff…

2 Likes

You might want to make a separate post about that, Paul. Mine worked out of the box, so there’s probably an underlying issue there.

Thanks Chris. There’s just a couple of things I want to try first before I do that. I’m sure one way or another I can get up and running.

Try running Sonic Pi on a Raspberry Pi and connect via MIDI.

Thanks for the suggestion but I don’t have a Raspberry PI. Once I’m up and running in Windows that’s something I will look into. Just want to make sure the program is right for mr before shelling out.

I mention it as the Raspberry Pi is inexpensive (I would use a Pi 3, which is $35) and performance is comparable to versions on Mac and WIndows (in my experience). Good luck with getting everything working.

1 Like

Thanks Tom, for the moment I am going to persevere with getting it working in Windows. About to post a thread to see if I can get some help :smiley:

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.

Lucky you! I am unlucky trying to build Sonic-Pi on my Xubuntu 18.04 and I’m still stuck in some kind of dependancy nightmare. I’m limited so far because my MacBook AIr is ready to implode everytime I build a complex VCV patch.

I totally agree with you about the fact that Sonic-Pi is a great way to control everything happening on a modular system, The ability to trigger sequences, record, do some advanced sampling on the side and in sync. I’m currently trying to design a system where I could use VCV+SP along with my BeatStep Pro and other midi controllers used for parametrical controls.

It is also great that VCV is free and open source. It expands dramatically the expressivity and sound-synthesis capabilities during a live-coding improvisation, without having to dive in the core SuperCollider side.

I wasn’t aware of the Throwasoft module even if I installed it on my computer. Will test it this afternoon.

Do you have videos or audio captations of you playing with SP+VCV?

I have not recorded anything yet using both together, but I’ll try. Videos are a no-go, my laptop can’t handle recording videos while running VCV Rack unfortunately.

Hi @Bubo

Have you tried this https://github.com/nlebellier/autour-de-sonic-pi/blob/master/scripts/build-ubuntu-18-04

Thanks to this script, i’m able to build the latest version on xubuntu-18-04-02 so maybe you will get it to work. But i know something is not as simple as this under linux. good luck

well you’re going to laugh… With the latest commit it doesn’t work… The built process is still working but when i launch it crashed.
funny no ?

terminate called after throwing an instance of 'boost::interprocess::interprocess_exception'
  what():  Aucun fichier ou dossier de ce type
./spi/sonic-pi/bin/sonic-pi : ligne 20 :  3390 Abandon                 (core dumped) $DIR/../app/gui/qt/sonic-pi

EDIT : Just to say it works with the commit c44b68bb602bfee6a87ff3c305cbd12a1864128c and it’s very cool to have fun with the ixi feature !

Just wanted to confirm this is working with the latest downloadable stable versions of VCV Rack and Sonic Pi 3.10.0 on Mojave 10.14.5. The only thing I had to do that was slightly non-obvious was enabled the “IAC Driver Bus 1” MIDI device in system settings, and make sure that name was used in @Bubo’s sample above.

1 Like

Hey @threecorneredvoid,

welcome to our community! Also, thanks for verifying this :slight_smile: