Sonic Pi + Volca = Good

This one is simple. Bought a Volca FM, connected with a usb-midi cable, sent it midi notes from Sonic Pi. It worked :smiley: Oh, I had to switch it on first. Very low latency, nice sounds. After all the shenanigans trying to get various software synths to work on Raspberry Pi this was fresh air.

Iā€™ve got this running in a SPi buffer, one loop takes local OSC and sends MIDI to the volca. The other one sends a sync note every 4 bars or so to a locally running VCV Rack to reset itā€™s clock.

#Osc2Midi V2

midi_all_notes_off

#Local Sync Pulse
live_loop :osc2midi_localsync do
  use_real_time
  n,v,d,ch = sync "/osc:127.0.0.1:4560/sync"
  midi n, v, channel: ch, sustain: d, port: "loopmidi_port"
end

#Volca
live_loop :osc2midi_volca do
  use_real_time
  n,v,d,ch = sync "/osc:127.0.0.1:4560/midi"
  midi n, v, channel: ch, sustain: d, port: "usb_midi_interface"
end

On a remote PC I have this similar script that receives OSC and sends MIDI notes to its VCV Rack

midi_all_notes_off
live_loop :osc2midi_recv do
  use_real_time
  n,v,d,ch = sync "/osc:192.168.1.64:4560/midi"
  midi n, v, sustain: d, channel: ch, port: "loopmidi_port"
end

On my ā€˜Conductor PCā€™ I simply send OSC notes to whatever remote device I choose, more or less as if they were play commands. This little bit of abstraction will make it easier to set things up, integrate other hardware, and allow switching between voices in the moment.

#Little ARP
12.times do
  osc "/midi", notes["34262847".ring[look].to_i],127,0.2,2 if "x-x-x-xxx".ring[tick]=="x"
end
1 Like

ā€¦Just to add the purpose of this: is to use SPi as both an instrument and a controller in one. SPi generates great sounds itself, while the external synths add flavour plus knob-turning tweakability for playing live. And to spread the load around.

hum, i miss something ? but i donā€™t see code sending a sync note. iā€™m pretty interested with your set up about the sync point.
Would you mind to show us all your code ? Github repo ?
Cheers

Hereā€™s a loop in the main buffer sending the sync note, via OSC. In this case every 4 bars and with a 70ms correction for latency, on MIDI Channel 16. VCV Rack picks that up and turns it into a trigger to reset its clocks

So Sonic Pi is sending an OSC message ā€˜to itselfā€™ so to speak, that then turns into a MIDI note_on/off. Yes, I could send a midi note directly, but this layer makes it easier to send things hither and thither - locally or remotely

live_loop :sync do
  sync :bar4
  time_warp 4-rt(0.07) do
    use_osc "127.0.0.1", 4560
    osc "/sync",49,127,0.1,16
  end
end
1 Like

Nice ideas in your code. Another method I used some time ago was to use a broadcast osc sync method with the aid of a small python script which you might find useful to try out. The post is here.

thanks !

How get this in vcv rack ?
screenshots are sometimes more useful than words :slight_smile:
what i mean, if you share why donā€™t share all your code ? itā€™s harsh to be in your head and every one has its limits me first :slight_smile:.
Maybe this tool could help all of us to give a schema : https://textik.com
Cheers and hope you wonā€™t get any offense :slight_smile:

1 Like

No offense taken :smiley: Iā€™m just surprised anyone wants it ha ha. But you asked for it, so I indeed I can put the whole lot up somewhere, VCV Rack patches, Sonic Pi scripts and all. Iā€™ll have to work out how best to do that.

To be fair, what Iā€™ve tried to do is distil the important bits of the code so anyone else could replicate it without all the fluff.

Only thing with Rack is that you have to be subscribed to all the same module authors as that patch uses. Iā€™ve only used free ones, but itā€™s a task.

For now, a little screenshot as requestedā€¦ This is the bit in my Rack patch that controls the syncing. The top row provides a pulse from a. loopMidi (i.e. from Spi) b. a midi keyboard or c. buttons on screen.

The 2nd row does some OR logic to run/stop the clock or reset it. From there, the clock drives the bits that make the sound - sequencers, whatever.

1 Like

@nlb here is all the code. All the Sonic Pi code/samples are vanilla, and all the VCV Rack Patches are free ones. If you know Rack, then you have to subscribe to all the module owners - they are mainstream ones, some included by default as I remember

  • 3 Voice Rack Patch - for playing MIDI notes sent by SPi
  • Soxsa Single Machine - for playing/tweaking live, runs off an internal clock that is syncā€™d using a single MIDI note sent by Spi every few bars. Two voices - one using a sequencer setup that records as you play from a keyboard, the other a granular synth working off .WAV samples.
2 Likes

To cap this off, elsewhere we talked about syncing devices using SPi to send midi clock pulses, and there were some problems.

This definitely doesnā€™t work in VCV Rack - where the clock jitters all over the place. I tried it the Volca, and it worked solidly. Iā€™m not planning to use it in this mode though, easier to have SPi do the sequencing and send midi notes. But itā€™s there.

ok worth to know ! every good scientist publishes its results even when they are not ā€œgoodā€ to avoid other people to waste time to explore a path, a dead end :slight_smile: