Is it possible to control via Sonic Pi an instrument in Ableton?


Works with Reason as well! Made a post on this topic:


As Ableton were my entry-point into musicproduction and it’s still my DAW of choice. I truly appreciate the information in this thread and it will surely come to use. Thanks!

1 Like

Hello fine folks!

Has anyone noticed timing issues when sending MIDI messages to their DAW via IAC or other virtual cable?

I hear audible jitter when sending a steady stream of 16th notes at 100bpm to Reaper, on a fresh reboot with no other apps open and bluetooth and WIFI turned off. use_real_time / use_sched_ahead_time makes no discernable difference. This is for a single channel of monophonic 16th notes via IAC on an i7 2015 MBP.

It’s my understanding that some amount jitter is unavoidable when using a virtual cable – or a physical one for that matter – but what I’m getting is unusable. I plan to do some digging, comparing jitter from SP -> Reaper vs Reaper -> Reaper on both Mac and Windows, but thought I would ask in here as well.

Alternately, does anyone know of a SuperCollider synthdef that will output a continuous CV-like audio signal?


Are you triggering a special MIDI channel? I’ve been experiencing strange behaviors when I was neglecting to precise a specific channel for each stream of notes:

midi :c2, channel: 1

It’s difficult to say precisely where the problem comes from in your situation. Can you tell us more about your config and about how you are routing from SP to your DAW? You should always have a steady stream if you’re not doing anything CPU intensive.


After more testing, the jitter seems to be introduced primarily by the IAC bus itself. I sent some 16th notes sequenced in Reaper out via IAC and they came back with the same drifting pattern. How irritating!


Argh, that’s annoying! Happy that it’s not Sonic Pi though :wink:


Leaving this breadcrumb for posterity: I have identified this as a Reaper issue.


I did some more digging, using ReceiveMIDI to log raw MIDI events with system timestamps, and a JS script I wrote to analyse the output.

Sonic Pi’s MIDI timing on Mac is excellent. Letting this loop ~500 times

use_midi_defaults port: 'usb2.0-midi_port_2', channel: 1
use_bpm 75

loop do
  midi_note_on 60
  sleep 0.125
  midi_note_on 60
  sleep 0.125

with MIDI signal path Sonic Pi MBP/OSX -> cheap MIDI<>DIN cable -> BCF2000 DIN input -> USB cable -> Win10 PC running receivemidi,
here is the histogram of durations in ms between the resulting MIDI events:

97: 3,
98: 37,
99: 196,
100: 510,
101: 203,
102: 36,
103: 1

That’s pretty solid, and more importantly, inaudible.

In Windows, however, it’s pretty ugly. Same code, Sonic Pi on Windows 10 PC -> LoopMIDI virtual cable -> receivemidi:

41: 1,
74: 1,
76: 1,
79: 1,
89: 3,
90: 16,
91: 40,
92: 76,
93: 89,
94: 130,
95: 91,
96: 49,
97: 15,
98: 10,
99: 16,
100: 21,
101: 29,
102: 14,
103: 3,
104: 14,
105: 41,
106: 55,
107: 70,
108: 37,
109: 37,
110: 48,
111: 43,
112: 24,
113: 6,
114: 9,
115: 2,
116: 5,
117: 2

This jitter is very much audible, and like sandpaper on my brain.

I did a test to make sure the virtual midi cable wasn’t the source of jitter, with Reaper Win10 sequencer -> Loop MIDI virtual port -> receivemidi:

98: 1,
99: 297,
100: 589,
101: 7,
102: 2,
103: 35,
104: 46 

Not quite as tight as OSX via physical MIDI cable, but nowhere near as bad as SP on the same Windows machine.

I’ll be looking into what might be causing this discrepancy across OS’s but @samaaron, do you have any idea what it might be?


Super useful data, thanks!

Great to hear that timing on macOS is solid. This MIDI timing is controlled by an Erlang scheduler written by the dear and late Joe Armstrong. There’s quite likely to be some discrepancy on how precise the timing is depending on the OS-specific APIs used in the Erlang code. I’m positive that this can be fixed. Joe also mentioned that a busy-waiting approach would eat a tiny bit of CPU but increase the accuracy even more on macOS.

To test my theory, would it be possible to do a similar timing experiment using OSC in a loopback rather than MIDI? If you see similar results (macOS tight and Windows jittery) then that would back-up my hypothesis.


@samaaron Confirmed, when logging OSC messages I’m seeing more or less the same distribution on Windows, and only +/- 1 ms variance on Mac.

1 Like

Wonderful, thanks for letting me know :slight_smile: