Just want to start slowly with vcv rack and sonic pi.
I just want to get the tempo from sonic pi to send into a seq module ?
If some of you can propose a little vcvrack patch to get this, you’re welcomed !
Almost. Take a look at the docstring for midi_clock_tick:
Sends a MIDI clock tick message to all connected devices on all channels. Use the port: and channel: opts to restrict which MIDI ports and channels are used.
Typical MIDI devices expect the clock to send 24 ticks per quarter note (typically a beat). See midi_clock_beat for a simple way of sending all the ticks for a given beat.
You’d therefore need to call midi_clock_tick 24 times per quarter note for it to work correctly as a MIDI clock generator. Alternatively you could use midi_clock_beat which does this for you:
It doesn’t work properly I’m afraid, if you try to drive a VCV Rack clock module from it, it jitters all over the place. I think it’s at the VCV Rack end rather than Sonic Pi, as midi clock works great with all the hardware devices I’ve tried.
I use rack with Spi a lot, just not the clock. Send it midi notes and CC, that works.
For the clock, just set it manually in rack to the song tempo. Sometimes I send a midi note to reset the clock, or just do it manually. Works a treat.
BTW I’ve seen a demo using the Arturia BeatStepPro where they get the same result putting midi clock into rack - tempo wanders about.
If it worked I’d used it for sure. I like VCV Rack a lot, and it’s a key part of my setup. But now I’ve got SPi, it’s often easier to do the sequencing in Spi and send midi notes than use the sequencers in rack.
If you want to see how the tempo wanders about, use the clock in rack called ‘Clocked’ (which is a great module IMO) and put the midi clock from the MIDI-CV into that input.
I’m hoping they’ll fix this in the next big release of rack, but don’t know when that’ll be. I did contemplate writing a module to smooth out the jitter, but didn’t in the end.
ok thanks a lot for your precious advices It will allow me not to loose time on this point. Very appreciated !
Do you have some code somewhere to inspire me where spi is used with Rack ?
You’re welcome. I don’t have one specific thing - as I just tend to substitute a Sonic Pi ‘play’ with a ‘midi’ command. My VCV Rack patch for working with SPi is constantly evolving, but with the basic idea of having one voice per rack line, with it’s own MIDI-CV module set to channel 1,2,3…
I can send you that if you like?
If it’s any help, this is my midi script that I put in buffer 9 and run first time. It’s set up for my USB-MIDI hub but can work with anything. You’ll see I’ve got various handy midi functions there, including :midistart and :midiclock (NOT for VCV Rack!)
#Midi4x4 Rpi V3 (Sonic PI 3.3)
#For Raspberry Pi
#midi4x4 ports like midi4x4_midi4x4_midi_1_28_0
#Midi4x4 port IDs
p=[]
n="28"
p[0]="midi4x4_midi4x4_midi_1_"+n+"_0"
p[1]="midi4x4_midi4x4_midi_2_"+n+"_1"
p[2]="midi4x4_midi4x4_midi_3_"+n+"_2"
p[3]="midi4x4_midi4x4_midi_4_"+n+"_3"
define :midi4x4 do |n,v,d,ch,pid|
midi n,v,channel: ch,sustain: d,port: p[pid]
end
define :midi4x4cc do |n,v,ch,pid|
midi_cc n,v,channel: ch,port: p[pid]
end
define :midistart do
midi_reset port: p[0], channel: 1
midi_start port: p[0], channel: 1
end
define :midiclock do |n|
in_thread do
n.times do
midi_clock_beat 1, port: p[0], channel: 1
sleep 1
end
end
end
live_loop :midiccin do
use_real_time
n,v=sync "/midi:mpk_mini_midi_1:1:1/control_change"
set "cc_"+n.to_s,v
end
define :cc do |n,min,max,default|
v=get["cc_"+n.to_s]
if v==nil
x=default
else
x=min+(v/128.0)*(max-min)
end
puts n.to_s + "," + x.to_s
x
end
Here’s a birds eye view of the Rack patch, can’t see the detail here but the top line is the mixer/delay/output and the three other lines are the voices, on midi channels 1,2,3. With this basic idea you can swap out voices as you fancy, or just keep it as a generic synth.
I have tried other arrangements - as I say, having a Rack patch with it’s own clock and sync’ing either with a midi note sent e.g. every 4 bars. Syncing by hand works fine in practice - we’re musicians after all eh?
Worth knowing that, unlike SPi, the VCV Rack clock will tend to drift on it’s own because of OS glitches so etc. so you do need to sync every now and then.
Oh for a vcv Rack newbie as me it’s a bit dizzying
i will try to take time to understand module one by one as if i have to buy them in real life with their real costs
What i just want to do at the moment and maybe others newbies would be interested is to send notes and cc messages to vcv rack
As you told me, do not try to synchronize Rack via spi, i would set the clock right into Rack with a clock module.
I believe that for newbies it’s a good point to use vcv modules to share our learnings.
ps : i would appreciate to receive the Rack patch though
Dizzying yes! There are so many modules, litterally thousands of them. I think that people tend to build up their favourties for control (sequencers, clock, gates, logic etc.) and then use them with all the different osciallators that are available.
Some of the modules are basic building blocks, and some have huge functionality built into them - and take a while to get to grips with. So indeed it’s good to spend quite a lot of time on each one.
Once you get the principles of CV, driving them is all very similar. At some point I’ll put up a patch - you have to ‘subscribe’ to the module brands to get them on your computer. As I say, these ones are bare bones, with all the music done in SPi.
I worked out that just one of my patches would cost about £5,000 in hardware. And lots of modules are software versions of real modules. One of the reasons VCV Rack is so amazing.
Here’s a patch 3-voice-MIDI… I can’t remember if rack prompts you for the modules it needs to download. If you open it and see lots of gaps compared to the screenshot above, that means you’re missing some modules. They’re all free ones.
Some you’ll definitely need:
Squinky Labs
Audible Instruments
Alright Devices
Stoermelder
Bogaudio
AS