Hi all,
I have for a while been looking for software to control hardware synths via MIDI, a tool that lets me create more complex sequences than a hardware sequencer will be able to.
I came across Sonic Pi and I’ve been playing around with it on and off for a while, and it’s a lot of fun, with the internal synths and samples. The MIDI functions are also very convenient.
However, when sending even very simple MIDI sequences, over time things seems to ‘clog up’. Beats are being skipped, notes become uneven in length and so on.
I own several synths and computers, and I’ve tested a lot of combinations - so it doesn’t look like the problem is related to specifics of the computer or the synth(s). Still, from what I’ve been reading and researching, people seems to me to be quite happy using MIDI this way, even live - what am I missing?
Hi Jon
I have used Sonic Pi with midi a fair bit driving external synths etc. Perhaps you could give us some example code where things have gone wrong for you. It’s easier to work out what may be going wrong with something to look at.
Hi Robin,
I believe I have subscribed to your channel on YouTube? If I’m correct, you are one of the ‘happy MIDI people’ I mentioned in my OP, so thanks for your response
The thing is, I haven’t really bothered to make any really significant code where MIDI is involved, as I wanted to find out if I could rely on it first.
I have stripped things down to the simple loop below. When I let this run for maybe a minute or so, some notes are skipped, and the longer I let it run, the more notes will be ignored. As I would expect, involving more channels results in a somewhat chaotic rythm over time
If i add the ‘sustain’-parameter into the mix, I find that the effect of the sustain are less and less noticeable - notes are getting ‘shorter’. Running long enough, the notes are reduced to short ticks only.
My suspect no. 1 at the moment is my USB to MIDI(DIN) cable, as it has a converter of some kind, that could maybe disturb the buffering?
-jon
set_sched_ahead_time! 2
live_loop :test do
midi :d2, channel: 1
sleep 0.5
end
Ian,
A very relevant question of course: Yes, I am running Windows. This might very well be the difference between others and me
Thanks;
-jon
The problem may be because you are running windows. Others have reported jitter problems on this platform, eg see Ian’s post above. I find it works well on my Mac and on my Raspberry PI4 which is running my own build from source on Sonic Pi. One thing to note. sustain: is used by default with a value of 1, so you might get a better response above if you used a smaller value eg sustain: 0.4, otherwise in the loop above you will get overlapping notes, although you may not hear that with a percussive synth eg a piano. The Sonic Pi midi command actually sends midi_on followed by a sleep (value sustain) followed by midi_off. Also it transmits on all available ports and channels, unless you specify which port and channel you want. (The available ports are listed in the IO prefs window. Try restricting things to the port and channel you are actually using eg:
port: "name_of_port_from_io_window", channel: 1
You can set this with the use_midi_defaults
command rather than specifying it every time you have a midi command if you want. eg
use_midi_defaults port: "name_of_port_from_io_window", channel: 1
EDIT YOu could also try a software synth on your windows machine eg helm or vmpk then you wouldn’t need your external midi cables. See this
2 Likes
I have a Raspberry Pi lying around, so I might try that along with your other tips. Thanks for engaging, this MIDI issue is kind of a showstopper for me regarding Sonic Pi, I was considering sticking to hardware sequencing. Now at the very least I have from the horse’s mouth that it should work
Thanks again!