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

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
end

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?