SEND SPi´s Midi to Another DAW

I’m a new user of Sonic Pi, I find it very attractive software.
I’m trying to send the midi generated in Sonic Pi to Ableton for recording or simply to play Ableton instruments directly, live.
I do this through the virtual port of Mac IAC.
In Ableton in Preference MIDI i have checked Input Track & Sync.
Through the Midi Out Sonic Pi manual I managed to record it in Ableton but there are two problems, I must be doing something wrong…
1_It is recorded in an unsynchronized way.
I have the same Bpm set in SPi and Ableton
2_When I press the SPi stop, the sound in Ableton continues to play, only if I turn off the Ableton synthesizer stop.
Thanks in advance

i think you should send a midi_note_off or just use midi instead of midi_note_on

1 Like

nlb Thank you so much for your help

With midi_note_off I don’t know how to do it but with only midi it works, it records well and when you press stop the sound stops.

The problem is that it keeps recording out of sync at the beginning.

With this other example the only midi doesn’t work, maybe I was wrong in the position, where should I put it?


hi @Lunatico

no idea for your sync question. Sorry
For chords with MIDI in sonic pi see this post

A lot of thanks for your great help nlb!
I copied your advice but I’m doing something wrong…

@Lunatico, which version of Sonic Pi are you using? Are you not able to use v3.2.2?

Also, you’re sending the release: opt to midi. If you look at the docs, you’ll see that midi only supports the sustain: opt.

When you say the synchronisation is off - I’m not sure what you mean. What were you expecting it to do and what did it actually do?

In that last example I think you want to change line 10 to

    midi_chord chord(:e3, :minor), sustain: 0.6


as Sam asked you : would you please indicate which spi version you are using ?
When you get errors, please screenshot the error feedback zone : we will have the error message with the error details.



Thank you all very much for your valuable help

This version corrected by emlyn works without runtime error.

The only problem is that when I stop the Sonic Pi´s run the sound gets hung up and only stops if I turn off the on of the Ableton´s virtual instrument.

I have an iMac with the Captain with the maximum version supported by its, the 3.1 with which I did everything published in the forum but today I did these tests with my MacBook Pro 2015 with catalina with the 3.2.2 version of Sonic Pi.

About synchronization :

I mean, when you press the Sonic pi´s run button, Ableton’s play is not activated simultaneously.

When I press Ableton’s record the midi is recorded in sync with the bpm set in both programs but I must quantize or move its beginning to Ableton’s beat 1.

Ideally, when I press the Sonic pi´s run it immediately sets Ableton’s record without me having to press it.

Thanks in advance


again i encourage everybody to always specify the sonic pi version used and the code causing the issue. the os is usefull too.
please dont change version without telling people : some errors are linked to some versions.

Always give us the full code. the debug zone sometimes doesn’t indicate the right line number so think to look at the lines above.

Error 1: The error here is that you have an erroneous call to the fn play after midi.

The code should be:

midi (chord :c4, :min), sustain: 0.6

Essentially you should use either play (for internal synths) or midi (for external MIDI synths).

Hope this helps!

Error 2: The problem here is that you’re passing a random element of the list [:e3, :minor] to your fn midi_chord as the first argument. The body of this fn first binds it to the local variable notes and then using .each attempts to work through each element which doesn’t make sense with either :e3 or :minor which are symbols not lists of notes.

You need to pass a list of notes to :midi_chord for it to work as written.

You can do this with:

midi_chord (chord :e3, :minor), sustain: 0.6

However, this means you don’t get the randomness of .choose but it’s not clear from the code what you’re trying to choose. Are you trying to choose a random note from the chord E3 Minor or are you trying to choose a random chord from a set of chords (which are yet to be defined)?

Hope that this helps.

Thank you all so much for your wonderful help.
I still need to study and practice to understand it better.
I will raise questions and new issues as they arise
Best Wishes

1 Like

Good luck and do continue to share your journey with us :slight_smile:

Thanks Sam! :grinning:

Do you have a plugin in ableton to send OSC messages? If you could Ableton to start recording and send an OSC message to Sonic Pi to start playing at the same time, you could technically get them entirely synchronized.

It sounds a bit tricky though:

  1. Sonic Pi OSC events include the source port of the OSC message, so you may need to tweak the sync event depending on how the OSC sender in Ableton works (whether it uses a static source UDP port)
  2. Sonic Pi triggers synths “in the future” by default. So you have to start recording in Ableton with a slight delay and/or reduce the sched_ahead_time in Sonic Pi.

maybe this post can help:

Sorry, I was MIA on this. Yes, @siimphh - that’s exactly what I put in the article that @nlb mentioned. You may not be able to do this with the Lite version, but LiveOSC does work. What didn’t seem to work the last time I tried, was using OSC to actually arm the transport for recording and then starting it with ‘play’. So, I used a normal MIDI map. It takes some screwing around because you need to make a small loop of just the midi send from Sonic Pi in order to have Ableton pick up on it and map it to the record button. But if you do things in the right order it does work.

Let me know if you have issues and maybe I can help. It’s been a bit since I’ve done this, and since have moved to REAPER and Bitwig Studio for the same exact thing on Linux, but if you run into some issue maybe it will trigger a memory :slight_smile:

Oh, and if you do have the full version of Ableton Live with Max For Live, another way of doing this is with the TouchOSC device and mapping any custom OSC commands you want to make with it to Ableton. I preferred to use Live OSC because it’s got a ton of commands already working and ready. But I’d check out @robin.newman’s great video.