Akai Mini MPK3 Drum Pad Usage

Hello everyone, my name is Ali and I am from Birmingham, UK. I am using Sonic Pi for over 3 months and I am completely in love with it. Also for over a week ago I started to use my Akai Mini MPK3 midi controller with Sonic Pi, but just with the piano keys. I was wondering, is there any way of triggering some sample sounds with using the drum pads at the top of the machine, because I can see it triggers the cue log, so obviously there must be a way of playing samples by using the drum pads.

Hope I could get some help on this topic.

Best regards,


maybe SP Performance Setup using an APC

Hi Ali
That should be possible. I don’t know the Mini MPK3 but from what I’ve read it says that the pads can be configured to either send note or control change or program change info.
If you assign a pad to send a control change message say midi_cc 7 then you can detect when this happens and use it to play a Sonic Pi Sample. I can do something similar with my rather ancient M_Audio Oxygen-8 keyboard which has rotary knobs that can be assigned to midi-cc signals.

live_loop :msample do #play sample according to triggered control change
  cc,data = sync "/midi*/control_change"
  sample :drum_cymbal_hard if cc == 7
  sample :drum_snare_hard if cc == 10

use_synth :tri

live_loop :mnote do #play note
  note,vel = sync "/midi*/note_on"
  play note,amp: vel/127.0

This simple program would play notes from the keyboard, but also respond to control_change signals 7 or 10 (adjustable) to play samples
If you can program your akai to assign two control channels to two of the pads you should be able to use this. If it is a pad then it probably sends data in the range 0->127 depending upon how hard you tap the pad. You could amend the program to respond to a certain value say > 80 using

sample :drum_cymbal_hard if cc == 7 and data >80
sample :drum_cymbal_hard if cc == 7 and data ==0
which would respond when the pad was released.

I hooked my Akai MPC 2000XL to Sonic Pi once and was able to trigger sounds in real time as well as set the sequencer to play patterns.

I just had to know the Midi notes that correspond with each pad and then make sure to have those notes set up in the code to correspond with the sample I wanted to play.
I’m not familiar with the Mini MPK3 but I would imagine it would be something similar.

Here’s the code I used:

sample1 = :bd_haus
sample2 = :drum_snare_hard
sample3 = :drum_cymbal_closed
sample4 = :drum_cymbal_open
sample5 = :drum_tom_lo_hard
sample6 = :drum_tom_mid_hard
sample7 = :drum_tom_hi_hard
sample8 = :drum_splash_hard
sample9 = :drum_cymbal_soft

live_loop :mpc do
  note, velocity = sync "/midi*/note_on"
  puts note
  set :b, note
  sample sample1 if note == 36
  sample sample2 if note == 46
  sample sample3 if note == 38
  sample sample4 if note == 42
  sample sample5 if note == 51
  sample sample6 if note == 48
  sample sample7 if note == 50
  sample sample8 if note == 49
  sample sample9 if note == 45

Hope this helps