# SEND SPi´s Midi to Another DAW

**URL:** <https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052>\
**Category:** Support, Help & Resources\
**Created:** [June 14, 2020, 6:50pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052 "2020-06-14T18:50:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lunatico](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lunatico](https://in-thread.sonic-pi.net/u/Lunatico)\
**Post date:** [June 14, 2020, 6:50pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/1 "2020-06-14T18:50:20Z")

</div>

Hi  
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  
Lorenzo

 ![Midi_To_Ableton](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/5/51d2ac0ae1acf6c5600fb70883c5de3bd47f3eed.jpeg)

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [June 14, 2020, 7:13pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/2 "2020-06-14T19:13:03Z")

</div>

> [@Lunatico](#):
>
> 2\_When I press the SPi stop, the sound in Ableton continues to play, only if I turn off the Ableton synthesizer stop.

i think you should send a midi\_note\_off or just use `midi` instead of `midi_note_on`

---

<div class="post-metadata">

**Author:** ![Lunatico](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lunatico](https://in-thread.sonic-pi.net/u/Lunatico)\
**Post date:** [June 14, 2020, 10:48pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/3 "2020-06-14T22:48:47Z")

</div>

![Midi_Out_Chord](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/0/0df271ef19909285dfa1dc1145a3e3a394727e60.jpeg)

Hi  
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?

Greetings

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [June 15, 2020, 2:01pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/4 "2020-06-15T14:01:46Z")

</div>

hi @Lunatico

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

> [@Choose MIDI Chord](https://in-thread.sonic-pi.net/t/choose-midi-chord/3673/3):
>
> After some research Sonic Pi does not support chords to be played via midi natively. But we can create a function to achieve that. @robin.newman proposed a solution in 2017 [https://github.com/samaaron/sonic-pi/issues/1691](https://github.com/samaaron/sonic-pi/issues/1691) so you can do that use\_midi\_defaults port: "midi\_through\_port-0", channel: 1 define :midi\_chord do |notes, \*args| notes.each do |note| midi note, \*args end end live\_loop :play\_chords\_via\_midi do midi\_chord chords.choose, release: 0.6 sleep 0.5 end …

---

<div class="post-metadata">

**Author:** ![Lunatico](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lunatico](https://in-thread.sonic-pi.net/u/Lunatico)\
**Post date:** [June 15, 2020, 6:25pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/5 "2020-06-15T18:25:09Z")

</div>

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

 ![Midi_Chords](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/f/f76daecab4cde71ea562537640a58f6c090fc747.jpeg)

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [June 15, 2020, 6:35pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/6 "2020-06-15T18:35:43Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![emlyn](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/emlyn/32/1460_2.png) [@emlyn](https://in-thread.sonic-pi.net/u/emlyn)\
**Post date:** [June 16, 2020, 1:35am UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/7 "2020-06-16T01:35:16Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [June 16, 2020, 8:15am UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/8 "2020-06-16T08:15:20Z")

</div>

Hi,

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.  
Cheers

---

<div class="post-metadata">

**Author:** ![Lunatico](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lunatico](https://in-thread.sonic-pi.net/u/Lunatico)\
**Post date:** [June 16, 2020, 7:29pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/9 "2020-06-16T19:29:45Z")

</div>

Error\_1

 ![Error_1](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/e/e22265e42e0cf7e8a6dafc4db97e39e4fe75477b.png)

---

<div class="post-metadata">

**Author:** ![Lunatico](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lunatico](https://in-thread.sonic-pi.net/u/Lunatico)\
**Post date:** [June 16, 2020, 7:30pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/10 "2020-06-16T19:30:29Z")

</div>

Error\_2

 ![Error_2](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/0/0914f412fb15c93d789c9efed2db4fdf7b007894.png)

---

<div class="post-metadata">

**Author:** ![Lunatico](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lunatico](https://in-thread.sonic-pi.net/u/Lunatico)\
**Post date:** [June 16, 2020, 7:31pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/11 "2020-06-16T19:31:23Z")

</div>

![Corrected_Hung](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/4/48e3d2a80e676dea825bda3ec3612ce86fa79e79.jpeg)

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

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [June 16, 2020, 7:41pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/12 "2020-06-16T19:41:48Z")

</div>

hi,

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.  
cheers

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [June 16, 2020, 8:01pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/13 "2020-06-16T20:01:04Z")

</div>

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

The code should be:

```ruby
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!

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [June 16, 2020, 8:06pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/14 "2020-06-16T20:06:42Z")

</div>

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:

```ruby
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.

---

<div class="post-metadata">

**Author:** ![Lunatico](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lunatico](https://in-thread.sonic-pi.net/u/Lunatico)\
**Post date:** [June 17, 2020, 7:58pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/15 "2020-06-17T19:58:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [June 17, 2020, 8:21pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/16 "2020-06-17T20:21:08Z")

</div>

Good luck and do continue to share your journey with us 🙂

---

<div class="post-metadata">

**Author:** ![Lunatico](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Lunatico](https://in-thread.sonic-pi.net/u/Lunatico)\
**Post date:** [June 18, 2020, 9:16am UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/17 "2020-06-18T09:16:19Z")

</div>

Thanks Sam! 😀

---

<div class="post-metadata">

**Author:** ![siimphh](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/siimphh/32/1851_2.png) [@siimphh](https://in-thread.sonic-pi.net/u/siimphh)\
**Post date:** [June 19, 2020, 6:30am UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/18 "2020-06-19T06:30:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [June 19, 2020, 12:05pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/19 "2020-06-19T12:05:07Z")

</div>

maybe this post can help:

> [@LiveOSC (Sonic Pi -\> Ableton Live)](https://in-thread.sonic-pi.net/t/liveosc-sonic-pi-ableton-live/3850):
>
> I’m still pretty new to Sonic Pi, but the first thing I needed was to try and record live\_loops to tracks in Ableton. My goal was to sync BPM and start recording with tracks armed. I couldn’t find this else where so thought I’d share what works so far on a Mac (not sure about Windows, but believe it works the same): UPDATE: Judging by a comment below, if you aren’t on a Mac you may need to install Python for this to work. [https://www.python.org/](https://www.python.org/) Install LiveOSC into the Live app on your system…

---

<div class="post-metadata">

**Author:** ![Hypostatic](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/hypostatic/32/1383_2.png) [@Hypostatic](https://in-thread.sonic-pi.net/u/Hypostatic)\
**Post date:** [June 19, 2020, 10:47pm UTC](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052/20 "2020-06-19T22:47:22Z")

</div>

Sorry, I was MIA on this. Yes, @siimphh - that’s exactly what I put in the [article](https://in-thread.sonic-pi.net/t/liveosc-sonic-pi-ableton-live/3850) that @nlb mentioned. You may not be able to do this with the Lite version, but [LiveOSC](https://github.com/ideoforms/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 🙂

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](https://in-thread.sonic-pi.net/t/sonic-pi-3-controls-ableton-live-9/699).

[Next page](https://in-thread.sonic-pi.net/t/send-spi-s-midi-to-another-daw/4052.md?page=2)
