# How to use Midi note\_on messages from drum pads

**URL:** <https://in-thread.sonic-pi.net/t/how-to-use-midi-note-on-messages-from-drum-pads/4583>\
**Category:** Support, Help & Resources\
**Created:** [November 6, 2020, 9:17pm UTC](https://in-thread.sonic-pi.net/t/how-to-use-midi-note-on-messages-from-drum-pads/4583 "2020-11-06T21:17:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjg123](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@mjg123](https://in-thread.sonic-pi.net/u/mjg123)\
**Post date:** [November 6, 2020, 9:17pm UTC](https://in-thread.sonic-pi.net/t/how-to-use-midi-note-on-messages-from-drum-pads/4583/1 "2020-11-06T21:17:46Z")

</div>

```ruby
# My midi controller (Arturia MiniLab Mk II) sends drum pad messages such as "/midi:arturia_minilab_mkii:0:10/note_on"
# but the below code doesn't work. sync blocks forever even though I can see the messages arriving in the
# "cues" window with the same name.

# it *does* work if I use "0:1" and play the keys
# it does work if I use "0:*" and play the keys *or* the pads

# what am I doing wrong?

live_loop :drum do
  use_real_time
  
  note,vel = sync "/midi:arturia_minilab_mkii:0:10/note_on" # 0:10 doesn't work here
  
  puts note.to_s + "::" + vel.to_s
  
  sample :bd_haus, amp: vel/127.0
  
end

```

---

<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:** [November 6, 2020, 9:34pm UTC](https://in-thread.sonic-pi.net/t/how-to-use-midi-note-on-messages-from-drum-pads/4583/2 "2020-11-06T21:34:03Z")

</div>

Hi there @mjg123,

apologies but there is a bug in v3.2.2 of Sonic Pi with MIDi devices containing multiple `:` in their description such as yours. This has been fixed and is part of the upcoming v3.3 (a BETA is currently available to Patreon supporters here: [https://www.patreon.com/posts/43441419](https://www.patreon.com/posts/43441419)). I hope to see v3.3 released freely in a few weeks.

For the meantime you can bypass this bug by using a `*` wildcard character in your description such as:

```ruby
sync "/midi:arturia_minilab_mkii*/note_on"

```

This matches all MIDI devices starting with `arturia_minilab_mkii` and avoids the use of `:` in the name which is what is causing the issue here.

Apologies again for the problem and I hope this helps you out.

---

<div class="post-metadata">

**Author:** ![mjg123](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@mjg123](https://in-thread.sonic-pi.net/u/mjg123)\
**Post date:** [November 6, 2020, 9:46pm UTC](https://in-thread.sonic-pi.net/t/how-to-use-midi-note-on-messages-from-drum-pads/4583/3 "2020-11-06T21:46:31Z")

</div>

Thank you Sam, that is helpful. Although I haven’t had any problem with the double - colon if I use the keys, which map to `:0:1`.

If I use the wildcard form in `sync` is there any way to determine which channel the event came from? I would ideally be able to use the keys in a synth and the pads for a sample.

---

<div class="post-metadata">

**Author:** ![mrkarlsson](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@mrkarlsson](https://in-thread.sonic-pi.net/u/mrkarlsson)\
**Post date:** [April 24, 2022, 2:43pm UTC](https://in-thread.sonic-pi.net/t/how-to-use-midi-note-on-messages-from-drum-pads/4583/4 "2022-04-24T14:43:08Z")

</div>

Hi,  
did you try match on  
note, velocity = sync “/midi\*10/note\_on”  
This works for me on v4 beta version

I also found out how to get the channel name from another [post](https://in-thread.sonic-pi.net/t/code-for-artiphone-instrument1/2922/3) by @robin.newman:  
puts get\_event("/midi:\*/\*").to\_s.split(",")[6]
