Stuck MIDI keys through USB interface
First published 29 August 2019
I have a Roland RD-150 keyboard from my younger days of playing in a wedding band, and I thought it might be fun to plug into my PC a play with some synthesizers. MIDI-to-USB converters go for as low as $5, so I bought one off eBay, plugged it in and installed the Reaper trial and ... it was terrible.
The first issue was latency: at least 300-500ms. This turned out to be easy to fix: just install the low-latency audio driver ASIO4ALL and configure Reaper to use it. Now there's no appreciable latency; playing the keyboard through Reaper with a virtual instrument feels the same as playing the keyboard with headphones plugged in.
The second issue was that I was getting a lot of “stuck notes”. That is, some notes would keep sounding after playing a little tune as if I was still holding them down. With a bit of experimentation I discovered that holding down any number of notes at the same time and then releasing them would cause the issue, and that pressing the stuck notes again would fix them.
I tried a couple of other DAWs (LMMS and Tracktion 7), thinking that Reaper was the issue, but they both had the same issue.
Pocket MIDI is an incredibly useful tool that shows the raw MIDI data. This convinced me that the cheap MIDI-to-USB adapter was the problem, as shown in this message log:
The MIDI byte stream is really easy to read:
FE
is a regular polling status byte that fires a couple of times a second.90 3C 2D
is a key press event (90
) of the key3C
with velocity2D
.80 3C 40
is the same key being released (80
) – the velocity (40
) is irrelevant for my keyboard.
You can see in the first block I have pressed and released a single note. In the second block I pressed and released two notes, the first of which successfully receives the key release event (80
), but the second of which shows a key press event (90
) instead! This was 100% reproducible – releasing a chord of any number of keys at once would send one correct 80
event, followed by incorrect 90
events for the remaining notes.
I eventually turned up someone else's description of the same problem, which squarely placed the blame at a firmware bug in my MIDI-to-USB converter.
It's impossible to tell from the eBay listings which model each converter is, so I shelled out $25 for an Artist cable, which looked sufficiently different cosmetically to be very unlikely to share the same firmware revision bug. And I absolutely refuse to pay Yamaha or Roland their exhorbitant $100 prices for a cable.
This new cable arrived today ... and it had the same problem! Either the cable does share the same firmware bug, or (more likely, I guess), my keyboard has a similar bug.
After a bit of messing around I happened upon a workaround though. My keyboard has a “split keyboard” functionality, allowing two (onboard, not MIDI) instruments to be assigned to different halves of the keyboard, as well as a "dual voice" functionality, in which two instruments play simultaneously for the full range of the keyboard. This is as simple as pressing two instrument toggles at the same time:
Watching the Pocket MIDI stream, I can see that in both of these modes each instrument is sent in its own channel (90/80
and 91/81
), and luckily, the key-release bug is not present:
It's easy enough (though a slight hassle) to configure Reaper to only record from a single MIDI channel (e.g., Channel 1) instead of its default “all channels” in order to avoid the voices doubling up. And voila – I am in business with my MIDI keyboard! (I already threw out the cheap cable, so I can't verify that the same workaround also works for it).