# Midi in events not triggering

**URL:** <https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492>\
**Category:** Support, Help & Resources\
**Created:** [March 22, 2020, 10:01pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492 "2020-03-22T22:01:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanju0](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/sanju0/32/1610_2.png) [@sanju0](https://in-thread.sonic-pi.net/u/sanju0)\
**Post date:** [March 22, 2020, 10:01pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/1 "2020-03-22T22:01:19Z")

</div>

Hello,

I have a launch control and I’d like to pair it with sonic pi. I got it working on sonic pi version 2, but I don’t know what could be hapenning now. As you can see on the following image, the midi events can be seen on the cue log, but it’s not executing the “synth :piano” line.  
Could I be missing something?

Thank you!

[[Album] Imgur ![](https://i.imgur.com/RePefeL.jpg?fb "Imgur") ](https://imgur.com/a/M4AhSbr)

---

<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:** [March 22, 2020, 11:27pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/2 "2020-03-22T23:27:43Z")

</div>

Could it be that you already have a live loop called `midi_piano` that was already syncing on a previous event that hasn’t been received?

Try pressing stop and then run again (or start Sonic Pi and try again if the app is closed).

---

<div class="post-metadata">

**Author:** ![sanju0](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/sanju0/32/1610_2.png) [@sanju0](https://in-thread.sonic-pi.net/u/sanju0)\
**Post date:** [March 23, 2020, 9:47am UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/3 "2020-03-23T09:47:00Z")

</div>

Hi Sam. Yes, tried that with no results. I’m running v3.2.0 on Windows 8.1, if it 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:** [March 23, 2020, 9:58am UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/4 "2020-03-23T09:58:48Z")

</div>

No idea what’s going wrong at all. Do you have anything in your log files - specifically `~/.sonic-pi/log/server-errors.log` or `server-output.log`.

Are you able to use `sync` with internal cues, such as those generated from live loops?

---

<div class="post-metadata">

**Author:** ![robin.newman](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robin.newman](https://in-thread.sonic-pi.net/u/robin.newman)\
**Post date:** [March 23, 2020, 10:22am UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/5 "2020-03-23T10:22:51Z")

</div>

In case there’s something wrong with your audio, try changing it to

puts “got here”  
instead of the  
synth :piano,note: 60

See if that works first.

---

<div class="post-metadata">

**Author:** ![sanju0](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/sanju0/32/1610_2.png) [@sanju0](https://in-thread.sonic-pi.net/u/sanju0)\
**Post date:** [March 23, 2020, 10:57am UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/6 "2020-03-23T10:57:28Z")

</div>

Hello Robin. I’ve tried with puts “something” too, but I’m not getting any message.

Here are the contents of log files:

server-errors-log:

```ruby
Failed to load the fast_osc c-extension, falling back to pure Ruby version
Overriding fast_osc c-extension FastOsc::decode_single_message, falling back to pure Ruby version
C:/Program Files/Sonic Pi/app/server/ruby/vendor/sys-proctable-1.1.3/lib/windows/sys/proctable.rb:97: warning: constant ::Fixnum is deprecated
C:/Program Files/Sonic Pi/app/server/ruby/vendor/sys-proctable-1.1.3/lib/windows/sys/proctable.rb:97: warning: constant ::Fixnum is deprecated
C:/Program Files/Sonic Pi/app/server/ruby/vendor/sys-proctable-1.1.3/lib/windows/sys/proctable.rb:97: warning: constant ::Fixnum is deprecated
C:/Program Files/Sonic Pi/app/server/ruby/vendor/sys-proctable-1.1.3/lib/windows/sys/proctable.rb:97: warning: constant ::Fixnum is deprecated

```

server-output-log:

```ruby
Sonic Pi server booting...
This is version 3.2.0 running on Ruby 2.7.0.
The time is 2020-03-23 10:35:05 +0100
Using primary protocol: udp
Detecting port numbers...
Listen port: 51235
  - OK
Scsynth port: 51237
  - OK
Scsynth send port: 51237
  - OK
OSC cues port: 4560
  - OK
Erlang port: 51240
  - OK
OSC MIDI out port: 51238
  - OK
OSC MIDI in port: 51239
  - OK
Websocket port: 51241
  - OK
Opening UDP Server to listen to GUI on port: 51235
Started [5816] [-] "C:\Program Files\Sonic Pi\app\server\native\scsynth.exe" -u 51237 -m 131072 -a 1024 -D 0 -R 0 -l 1 -i 16 -o 16 -U "C:/Program Files/Sonic Pi/app/server/native/plugins/" -b 4096 -B 127.0.0.1 [-] C:/Users/jsanjuan/AppData/Local/Temp/sonic-pi-pids/5816
Started [4596] [-] "C:/Program Files/Sonic Pi/app/server/native/erlang/bin/erl.exe" -noshell -pz "C:/Program Files/Sonic Pi/app/server/erlang" -s pi_server start 51240 4560 51235 [-] C:/Users/jsanjuan/AppData/Local/Temp/sonic-pi-pids/4596
Started [3972] [-] 'C:/Program Files/Sonic Pi/app/server/native/osmid/o2m.exe' -L -b -i 51238 -O 51239 -m 6 [-] C:/Users/jsanjuan/AppData/Local/Temp/sonic-pi-pids/3972
Started [5484] [-] 'C:/Program Files/Sonic Pi/app/server/native/osmid/m2o.exe' -t /midi:$n:$i:$c/$m -b -o 51239 -m 6 'Sonic Pi' [-] C:/Users/jsanjuan/AppData/Local/Temp/sonic-pi-pids/5484
Starting Server Runtime
Booting server...

Booting Sonic Pi
----------------

Booting on Windows
Boot - Starting the SuperCollider server...
Boot - C:/Program Files/Sonic Pi/app/server/native/scsynth.exe -u 51237 -m 131072 -a 1024 -D 0 -R 0 -l 1 -i 16 -o 16 -U C:/Program Files/Sonic Pi/app/server/native/plugins/ -b 4096 -B 127.0.0.1
Boot - SuperCollider booted successfully.
Boot - Connecting to the SuperCollider server...
Boot - Sending /status to server: 127.0.0.1:51237
Boot - Receiving ack from scsynth
Boot - Server connection established
Studio - Initialised SuperCollider Audio Server v3.10.4
Studio - Resetting server
Studio - Studio - clearing scsynth
Studio - Studio - allocating audio bus
Studio - Studio - Create Base Synth Groups
Studio - Starting mixer
Studio - Starting scope
"C:/Program Files/Sonic Pi/app/server/native/erlang/bin/erl.exe" -noshell -pz "C:/Program Files/Sonic Pi/app/server/erlang" -s pi_server start 51240 4560 51235
Studio - Spawning o2m with:
    'C:/Program Files/Sonic Pi/app/server/native/osmid/o2m.exe' -L -b -i 51238 -O 51239 -m 6
Studio - Spawning m2o with:
    'C:/Program Files/Sonic Pi/app/server/native/osmid/m2o.exe' -t /midi:$n:$i:$c/$m -b -o 51239 -m 6 'Sonic Pi'
Studio - Initialised MIDI subsystems
This is Sonic Pi v3.2 running on windows with ruby api 2.7.0.
Sonic Pi Server successfully booted.
Server is exiting.
Shutting down GUI...
Goodbye :-)
Exiting - shutting down scsynth server...
Sending /quit command to scsynth
Stopping OSC server...
Stopped OSC server...

```

---

<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:** [March 23, 2020, 12:59pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/7 "2020-03-23T12:59:47Z")

</div>

Super odd - these log files look absolutely fine to me.

Are you able to use explicit calls to `cue` and `sync` as expected?

---

<div class="post-metadata">

**Author:** ![sanju0](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/sanju0/32/1610_2.png) [@sanju0](https://in-thread.sonic-pi.net/u/sanju0)\
**Post date:** [March 23, 2020, 5:36pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/8 "2020-03-23T17:36:29Z")

</div>

🤔 Yes, `cue` and `sync` are working ok.

(edit) …and the Launch Control is receiving midi messages (for switching on-off buttons) from Sonic Pi with no problem

---

<div class="post-metadata">

**Author:** ![sanju0](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/sanju0/32/1610_2.png) [@sanju0](https://in-thread.sonic-pi.net/u/sanju0)\
**Post date:** [March 24, 2020, 6:39pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/9 "2020-03-24T18:39:00Z")

</div>

In the first message I wrote that it was working on version 2. Obviously, this is wrong, because midi functions started on sonic pi 3. So, the working version I was using was 3.1. Now I’m back to v3.1 and it works again

---

<div class="post-metadata">

**Author:** ![BN1701](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@BN1701](https://in-thread.sonic-pi.net/u/BN1701)\
**Post date:** [July 14, 2020, 4:45pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/10 "2020-07-14T16:45:41Z")

</div>

I’ve just got hold of version 3.2.2 on Windows 10 and I’ve been working through the tutorial for the last few hours. I was just trying out the example in section 11.1 and I’ve just hit this issue, too. Midi events - I’m specifically looking for note-ons - are appearing in the Cues window, but the live loop doesn’t trigger. Everything else has worked wonderfully up till now. (I’ve been specifically interested in the threading/live loop examples.) Like the original poster, I tried moving back to version 3.1 and yes, this does work. I noticed in 3.1 that midi in events are named with forward slashes in 3.1 - “/midi/modal\_002\_48/25/1/note\_on”, but in 3.2 there are colons - “/midi:modal\_002\_48:25:1/note\_on”. Is this likely to be significant?

Also, I noticed with 3.2.2 that after stopping and restarting Sonic Pi all midi inputs are likely to have disappeared from the Midi Ports list in Preferences/IO. (Output devices are always present.) Restarting the PC will reset this. With 3.1 I’ve seen this happen once, but most times input devices show up each time I restart Sonic Pi.

I’m a longtime programmer/hacker, though not with this particular environment, but happy to dig in and help debug if given a few clues as to what to do next.

---

<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:** [July 14, 2020, 7:21pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/11 "2020-07-14T19:21:11Z")

</div>

hi @BN1701,

Please post your code you are testing to help us to help you 🙂

> [@BN1701](#):
>
> that midi in events are named with forward slashes in 3.1 - “/midi/modal\_002\_48/25/1/note\_on”, but in 3.2 there are colons - “/midi:modal\_002\_48:25:1/note\_on”. Is this likely to be significant?

yep it’s normal. there is a change between these two versions.  
[Midi changes for upcoming Sonic Pi 3.2](https://in-thread.sonic-pi.net/t/midi-changes-for-upcoming-sonic-pi-3-2/3319)

---

<div class="post-metadata">

**Author:** ![BN1701](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@BN1701](https://in-thread.sonic-pi.net/u/BN1701)\
**Post date:** [July 14, 2020, 9:28pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/12 "2020-07-14T21:28:14Z")

</div>

Thanks for the reply. The code is just the example from the tutorial, section 11.1, modified with my own midi in port info and with an extra puts call for debugging:

live\_loop :midi\_piano do  
note, velocity = sync “/midi:modal\_002\_48:25:1/note\_on”  
puts “Hello …”  
synth :piano, note: note  
end

Nothing appears in the log after the initial run info, despite fresh midi events showing in the Cues panel. (Screen shot attached, I hope.)

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/8/86eb993876c52e21c58fbafc92782d66b7d36ee1.png)

---

<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:** [July 15, 2020, 9:34am UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/13 "2020-07-15T09:34:05Z")

</div>

see this topic

> [@MIDI Keyboard with Sonic Pi No Audio](https://in-thread.sonic-pi.net/t/midi-keyboard-with-sonic-pi-no-audio/4202/16):
>
> There is currently a bug in v3.2 when using multiple : in a sync path. This has been fixed on the main branch and will be fixed in the upcoming betas and next release. Apologies. Until then, you can use the \* fix as detailed above to mask the error slight_smile

---

<div class="post-metadata">

**Author:** ![BN1701](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@BN1701](https://in-thread.sonic-pi.net/u/BN1701)\
**Post date:** [July 16, 2020, 11:57am UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/14 "2020-07-16T11:57:41Z")

</div>

Update …

I think the issues I’m having are to do with midi loops. I had been running loopMidi from [Tobias Erichsen](https://www.tobias-erichsen.de/), which provides a way of sending midi between apps running on the same PC. I see from the Midi Ports list that Sonic Pi automatically opened the inputs _and_ outputs of the ports that I had set up in loopMidi. Shutting down loopMidi and restarting the PC (I previously had loopMidi running automatically at startup) the example code that I posted previously now runs as intended. So, I have two questions:

Firstly, why wasn’t this a problem in version 3.1?

Secondly, is there a way of choosing which midi ports are opened by Sonic Pi?

This second feature would be great to have regardless of the current problem, as in Windows only some USB/midi drivers can be shared/opened by more than one app and once Sonic Pi has grabbed all the ports nothing else can use them (even when Sonic Pi doesn’t actually need them). This applies to any devices which use the Windows class compliant driver. (In fact I only have two devices out of about ten that have their own custom drivers, all the others have to use Windows’ own non-sharable class compliant driver.)

Thanks,

BN

---

<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:** [July 16, 2020, 12:07pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/15 "2020-07-16T12:07:39Z")

</div>

> [@BN1701](#):
>
> Secondly, is there a way of choosing which midi ports are opened by Sonic Pi?

sonic pi shows you midi ports available. Then you specify which midi port you want to send messages via the midi instruction options :

```ruby
use_midi_defaults port: "loopmidi01", channel: "11"

```

or

```ruby
midi :e1, channel: 3, port: "loopmidi01"

```

I often use loop midi with no pb at all.

---

<div class="post-metadata">

**Author:** ![BN1701](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@BN1701](https://in-thread.sonic-pi.net/u/BN1701)\
**Post date:** [July 16, 2020, 12:20pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/16 "2020-07-16T12:20:18Z")

</div>

Sorry nlb, that’s not what I mean. I know how the functions ‘midi’ and ‘use\_midi\_defaults’ allow you to choose where to send midi, but Sonic Pi opens all available ports regardless of whether you intend to use them. Just try opening up your Daw whilst Sonic Pi is running. All the class compliant devices will be unavailable because Sonic Pi has already grabbed them.

---

<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:** [July 16, 2020, 12:31pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/17 "2020-07-16T12:31:25Z")

</div>

> [@BN1701](#):
>
> Sorry nlb, that’s not what I mean.

Ok sorry. would you give more details about your set ?

---

<div class="post-metadata">

**Author:** ![BN1701](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@BN1701](https://in-thread.sonic-pi.net/u/BN1701)\
**Post date:** [July 16, 2020, 3:06pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/18 "2020-07-16T15:06:32Z")

</div>

> [@nlb](#):
>
> Ok sorry. would you give more details about your set ?

Here’s a screenshot showing midi ports not being shared. Hopefully you’ll see what my setup is like from this, too (though I’ve turned off most of it to simplify what’s going on):

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/9/998bff21c66fc15a8d6656acd0ead1facc57d15d.png)

In the background you’ll see that Sonic Pi has opened four usb devices. If then I load Reaper it reports that it can’t open three of them. These three all use Windows’ own class compliant USB/Midi driver. The fourth device is my RME Babyface, and that has a custom USB/Midi driver provided by RME and this is open properly in Sonic Pi and in Reaper. If I close down Sonic Pi at this point and click Retry in Reaper, all ports will be opened.

It is generally known that the Windows class compliant USB/Midi driver can’t be shared between apps. This is not a problem with Sonic Pi. The way that most apps deal with the situation is to provide a configuration mechanism for opening only those devices that you actually want to use within a session and leaving the rest alone. This is what I was asking if Sonic Pi could do, because it would make things much more flexible overall. For referene, Reaper’s configuration dialog looks like this, though a configuration script stored somewhere would be just as useful to me:

![image](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/b/b4f80ddc76184b3406b90619b5477b485a2e151d.png)

On loopMidi (and midi feedback potentially being a problem), after you said that you’d been using loopMidi without problems, I checked again here. This time I can’t find a problem with it either, at least not one that I can reproduce ☹ I’m now back to not knowing why I had the problem in the first place. I’ll just have to keep trying things out and see what turns up.

Thanks for all the replies 🙂

---

<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:** [July 16, 2020, 7:55pm UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/19 "2020-07-16T19:55:47Z")

</div>

thank you for your screenshots 👌

as you use 3…2.2, your code should use /midi\*/note\_on no ?

sorry but to be clear what do you want to do ? Use reaper to send midi notes to spi ? use sonic pi to send midi notes to reaper ? the midi link is created via loopMIDI ?  
Hope others can help you morenthan i do 😳

---

<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:** [July 17, 2020, 11:11am UTC](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492/20 "2020-07-17T11:11:45Z")

</div>

to be honest i’ve never heard about

> [@BN1701](#):
>
> It is generally known that the Windows class compliant USB/Midi driver can’t be shared between apps.

[Next page](https://in-thread.sonic-pi.net/t/midi-in-events-not-triggering/3492.md?page=2)
