How to connect Akai MPK Mini Midi keyboard to Sonic Pi

I am trying to connect a midi keyboard to Sonic Pi.

I used the code below

live_loop :midi_input do
  note, velocity = sync "/midi:MPK_mini:1:1/note_on"
  synth :pretty_bell, note: note, amp: velocity / 127.0

I can see when I press the keys on Midi Keyboard, I see the note, but I don’t hear any sound.

Please help how to fix this, or am I missing something? I have checked if MIDi is connected, and it is.

Hi, at a first glance I’d say you get the wrong channel. You catch


while you keyboards sends on


So, there’s a case, a number, and an underscore error :wink: When Sonic Pi is not running (SuperCollider Audio Server stopped) you can cut and paste from the cues window. Also, you can use wildcards, which may be a good idea, as your keyboard may get a different channel the next time you connect it.

1 Like