# MIDI Keyboard constantly registers a low note

**URL:** <https://in-thread.sonic-pi.net/t/midi-keyboard-constantly-registers-a-low-note/1033>\
**Category:** \[P\] Patreon Support\
**Created:** [April 26, 2018, 3:42pm UTC](https://in-thread.sonic-pi.net/t/midi-keyboard-constantly-registers-a-low-note/1033 "2018-04-26T15:42:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sentient](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Sentient](https://in-thread.sonic-pi.net/u/Sentient)\
**Post date:** [April 26, 2018, 3:42pm UTC](https://in-thread.sonic-pi.net/t/midi-keyboard-constantly-registers-a-low-note/1033/1 "2018-04-26T15:42:28Z")

</div>

I’ve plugged in my MIDI keyboard to my laptop and set it up for MIDI on Sonic Pi, and instead of responding to what I play on the keyboard when the program is run the cue/log says it’s playing note 0, pretty much every tick, with a velocity of 127. I’m unable to play anything else. I’ve tried resetting the MIDI devices but it keeps on happening. Also, I’ve tried playing notes while having Logic Pro open and it doesn’t seem to run into this issue on there.

Specs:

Sonic Pi 3.0.1  
macOS 10.12  
Novation Launchkey 49

Any help would be greatly appreciated. Thanks!!

---

<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:** [April 26, 2018, 3:49pm UTC](https://in-thread.sonic-pi.net/t/midi-keyboard-constantly-registers-a-low-note/1033/2 "2018-04-26T15:49:37Z")

</div>

Hi, sorry you’re having issues. Could you try/answer the following to provide a bit more context?

1. Could you first update to the latest release `v3.1` and try with that.
2. What do you mean by _“pretty much every tick”_.
3. Could you share a copy of the cue log so we can see what’s going on?

---

<div class="post-metadata">

**Author:** ![Sentient](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Sentient](https://in-thread.sonic-pi.net/u/Sentient)\
**Post date:** [April 26, 2018, 11:47pm UTC](https://in-thread.sonic-pi.net/t/midi-keyboard-constantly-registers-a-low-note/1033/3 "2018-04-26T23:47:25Z")

</div>

I updated to 3.1, still the same issue.

Here’s the log:

=\> Starting run 1

=\> Defining fn :drum1

=\> Defining fn :drum2

=\> Defining fn :drum3

=\> Defining fn :drum4

=\> Defining fn :live\_loop\_drums

=\> Loaded sample “/Applications/Sonic Pi.app/etc/samples/drum\_bass\_hard.flac”

=\> Defining fn :live\_loop\_time

=\> Defining fn :live\_loop\_synthcontrol

=\> Loaded sample “~/Desktop/sonicpi/proj1/wav/2 kick1.wav”

=\> Defining fn :live\_loop\_synth1

{run: 1, time: 0.2206, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 0.0}  
└─ sample “/Applications/Sonic Pi.app/etc/samples”,  
“drum\_bass\_hard.flac”, {rate: 0.5}

{run: 1, time: 0.0}  
└─ sample “~/Desktop/sonicpi/proj1/wav”,  
“2 kick1.wav”, {amp: 0.0, pan: 0.9145, pan\_slide: 1.6, lpf: 100}

{run: 1, time: 0.0, thread: :live\_loop\_synth1}  
└─ synth :blade, {note: 75.0, pan: 1}

{run: 1, time: 0.5245, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 0.8284, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 1.1323, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 1.4364, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

=\> Loaded sample “/Applications/Sonic Pi.app/etc/samples/drum\_snare\_hard.flac”

{run: 1, time: 1.7405, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 2.0443, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 1.6, thread: :live\_loop\_synth1}  
└─ synth :blade, {note: 75.0, pan: -1}

{run: 1, time: 1.6}  
└─ sample “/Applications/Sonic Pi.app/etc/samples”,  
“drum\_snare\_hard.flac”, {rate: 0.55}

{run: 1, time: 2.3484, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 2.6522, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 2.9563, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 3.2603, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 3.5643, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 3.2, thread: :live\_loop\_drums}  
└─ sample “/Applications/Sonic Pi.app/etc/samples”,  
“drum\_bass\_hard.flac”, {rate: 0.5}

{run: 1, time: 3.2, thread: :live\_loop\_synth1}  
└─ synth :blade, {note: 75.0, pan: 1}

{run: 1, time: 3.868, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 3.6, thread: :live\_loop\_drums}  
└─ sample “/Applications/Sonic Pi.app/etc/samples”,  
“drum\_bass\_hard.flac”, {rate: 0.5}

{run: 1, time: 4.1724, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 4.4762, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 4.7803, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 5.0841, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 4.8, thread: :live\_loop\_drums}  
└─ sample “/Applications/Sonic Pi.app/etc/samples”,  
“drum\_snare\_hard.flac”, {rate: 0.55}

{run: 1, time: 4.8, thread: :live\_loop\_synth1}  
└─ synth :blade, {note: 75.0, pan: -1}

{run: 1, time: 5.3879, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 5.6923, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 5.996, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 6.2999, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 6.604, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 6.4, thread: :live\_loop\_drums}  
└─ sample “/Applications/Sonic Pi.app/etc/samples”,  
“drum\_bass\_hard.flac”, {rate: 0.5}

{run: 1, time: 6.4, thread: :live\_loop\_synth1}  
└─ synth :blade, {note: 75.0, pan: -1}

{run: 1, time: 6.4, thread: :live\_loop\_time}  
└─ sample “~/Desktop/sonicpi/proj1/wav”,  
“2 kick1.wav”, {amp: 0.0, pan: 0.5292, pan\_slide: 1.6, lpf: 100}

{run: 1, time: 6.9079, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 7.212, thread: :live\_loop\_synthcontrol}  
└─ synth :piano, {note: 0.0, amp: 1.5}

{run: 1, time: 6.8, thread: :live\_loop\_drums}  
└─ sample “/Applications/Sonic Pi.app/etc/samples”,  
“drum\_bass\_hard.flac”, {rate: 0.5}

=\> Stopping all runs…

=\> Stopping run 1

=\> Completed run 1

=\> All runs completed

=\> Pausing SuperCollider Audio 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:** [April 27, 2018, 10:56am UTC](https://in-thread.sonic-pi.net/t/midi-keyboard-constantly-registers-a-low-note/1033/4 "2018-04-27T10:56:11Z")

</div>

Hi, thanks for this but that’s the output log. The contents of the cue log below would be much more helpful to see. What are you seeing in that when you hit your keyboard? Also what code are you running?

---

<div class="post-metadata">

**Author:** ![Sentient](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Sentient](https://in-thread.sonic-pi.net/u/Sentient)\
**Post date:** [April 27, 2018, 12:26pm UTC](https://in-thread.sonic-pi.net/t/midi-keyboard-constantly-registers-a-low-note/1033/5 "2018-04-27T12:26:31Z")

</div>

Every time I plug in my keyboard my cue log gets flooded by this:  
/midi/launchkey\_49\_launchkey\_incontrol/1/1/note\_on [0, 127]

I get similar messages with appropriate note number and velocity if I play any notes on the keyboard.  
I can’t copy the cue log, I’m sorry.

 ![02%20PM](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/1X/991fc73140ff01fcc0f3a1255f47e71772588f36.png)

MPT = “/Users/USRN/Desktop/sonicpi/proj1/wav”

define :drum1 do  
sample :drum\_bass\_hard, rate: 0.5  
sleep 1.6  
sample :drum\_snare\_hard, rate: 0.55  
sleep 1.6  
end

define :drum2 do  
sample :drum\_bass\_hard, rate: 0.5  
sleep 0.4  
sample :drum\_bass\_hard, rate: 0.5  
sleep 1.2  
sample :drum\_snare\_hard, rate: 0.55  
sleep 1.6  
end

define :drum3 do  
sample :drum\_bass\_hard, rate: 0.5  
sleep 0.4  
sample :drum\_bass\_hard, rate: 0.5  
sleep 0.8  
sample :drum\_bass\_soft, rate: 0.5  
sleep 0.2  
sample :drum\_bass\_hard, rate: 0.5  
sleep 0.2  
sample :drum\_snare\_hard, rate: 0.55  
sleep 1.6  
end

define :drum4 do  
sample :drum\_bass\_hard, rate: 0.5  
sleep 0.4  
sample :drum\_bass\_hard, rate: 0.5  
sleep 0.8  
sample :drum\_bass\_soft, rate: 0.5  
sleep 0.2  
sample :drum\_bass\_hard, rate: 0.5  
sleep 0.2  
sample :drum\_snare\_hard, rate: 0.55  
sleep 0.18  
sample :drum\_bass\_hard, rate: 0.5  
sleep 1.42  
end

define :drum5 do  
sample :drum\_bass\_hard, rate: 0.5  
sleep 0.4  
sample :drum\_bass\_hard, rate: 0.5  
sleep 0.8  
sample :drum\_bass\_soft, rate: 0.5  
sleep 0.2  
sample :drum\_bass\_hard, rate: 0.5  
sleep 0.2  
sample :drum\_snare\_hard, rate: 0.55  
sleep 0.2  
sample :drum\_snare\_hard, rate: 0.35  
sleep 0.2  
sample :drum\_snare\_hard, rate: 0.25  
sleep 0.2  
sample :drum\_snare\_hard, rate: 0.15  
sleep 1  
end

with\_fx :reverb, mix: 0.5, amp: 1.5 do  
live\_loop :drums do  
drum1  
choose([drum2, drum3, drum4])  
end  
end

with\_fx :reverb, mix: 0.5, amp: 0.3 do  
with\_fx :ixi\_techno, mix: 0.8 do  
live\_loop :glitch do  
sleep 0.4  
sample [:glitch\_perc1, :glitch\_perc2, :glitch\_perc3, :glitch\_perc4].choose  
sleep [1.2, 0.4, 2].choose  
end  
end  
end

with\_fx :gverb, mix: 0.3 do  
live\_loop :time do  
n = sample MPT, 1, amp: 4, cutoff: 100, pan\_slide: 1.6  
sleep 6.4  
end  
end

live\_loop :synthcontrol do  
use\_real\_time  
note, velocity = sync “/midi/launchkey\_49\_launchkey\_incontrol/1/1/note\_on”  
synth :piano, note: note, amp: velocity / 127.0 + 0.5  
end

with\_fx :reverb, mix: 0.5, amp: 0.5 do  
live\_loop :synth1 do  
use\_synth :blade  
play 75, pan: [-1, 1].choose  
sleep 1.6  
end  
end

For now, is there any way to make my code bypass note number 0 on my MIDI keyboard? It looks like it should work otherwise.

---

<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:** [April 27, 2018, 1:34pm UTC](https://in-thread.sonic-pi.net/t/midi-keyboard-constantly-registers-a-low-note/1033/6 "2018-04-27T13:34:52Z")

</div>

Ah, ok - this makes much more sense.

Essentially your keyboard is sending lots of messages to Sonic Pi which it is printing out as they arrive. This is something specific to your keyboard. Perhaps it’s in a special mode where it is configured to send these messages out.

As far as I can see you have two options:

1. Configure your keyboard not to send automatic messages
2. Only listen for messages where the note is _not_ 0 using a conditional clause in your `sync`

I can’t help with 1, but 2 can be achieved with the following:

```ruby
live_loop :synthcontrol do
  use_real_time
  note, velocity = sync "/midi/launchkey_49_launchkey_incontrol/1/1/note_on"
  synth :piano, note: note, amp: velocity / 127.0 + 0.5 if note != 0
end

```

Unfortunately there’s currently no way of filtering the messages that appear in the cue log. This is something I hope to add in a future version.

---

<div class="post-metadata">

**Author:** ![Sentient](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Sentient](https://in-thread.sonic-pi.net/u/Sentient)\
**Post date:** [April 27, 2018, 1:45pm UTC](https://in-thread.sonic-pi.net/t/midi-keyboard-constantly-registers-a-low-note/1033/7 "2018-04-27T13:45:59Z")

</div>

I’m so sorry! Turns out this is my mistake. My keyboard shows up as two devices: launchkey\_49\_launchkey\_midi and launchkey\_49\_launchkey\_incontrol. I switched the two and it works.
