[Solved] Help troubleshooting MIDI input

Hi all!

I’m brand new to Sonic Pi and am trying to get the MIDI in example from the online help to work with my M-Audio Keystation Mini 32.

Here’s the code:

live_loop :midi_piano do
  use_real_time
  note, velocity = sync "/midi/keystation_mini_32/0/1/note_on"
  synth :piano, note: note, amp: velocity / 127.0
end

I’m seeing log messages from it like:

/midi/keystation_mini_32/0/1/note_on [52, 64]
/midi/keystation_mini_32/0/1/note_on [52, 0]

… when I hit the keys, so that’s working.

  • I confirmed that the /midi/ device matches, but it’s not triggering sounds.
  • I can add play commands and those play notes as well

I assume it’s something simple that I’m missing. I’m on a 2008 Macbook Pro 15" running 10.11.6 and Sonic Pi 3.1.0.

Any idea what I’m doing wrong?

I figured it out.

I think I must have had “Enforce timing guarantees” set. I noticed “Out of time” messages in the logs and tracked it to a suggestion in the issue tracker on github.

2 Likes

Sorry about that - this is a bug - threads that are in real time mode should bypass the timing guarantee check. I’ll fix this before the next release, but until now, you’re right - the solution is to uncheck the “Enforce timing guarantees”.

1 Like