Sunday, October 21, 2012

Midi Drum Keyboard

Aside from my daytime superhero duties, I'm also the drummer for The Elixxxirs. I've been playing the drums since I was 18 but frankly I'm pretty lazy about it -- practicing always seems to fall off the end of the list, so improvement is slow.

One thing I have no trouble with is typing. Fast. I've been variously laughed at and asked to stop noisily mashing the keys by people who didn't believe I was actually typing coherently in the process. And I couldn't help but think -- what if I could apply the dexterity I get by spending my days typing to simultaneously improving my drumming?

All it takes is a digital drum set, a midi to USB adapter, and a little bit of code...

Let's just pretend I'm being serious for a moment. One of the things you try to do when you're practicing the drums is break associations and habits. It's so easy to stick to a rock beat, but if that's all you play, you'll be hard-wiring your brain to hit the bass drum and hats on the 1 and the snare and the hats on the 3, end of story. Adding some practice that's totally random from a musical standpoint might actually be a good idea.

And look at the flip side -- you can hide secret messages in your music. Most of the words they don't allow on the radio would suit 4/4 time perfectly.

(It hasn't escaped my notice that I probably would've been better off spending this time actually practicing the drums instead of tinkering.)

(This is the second-to-last hack I'll be posting before the East Side Culture Crawl happens here in Vancouver in November. I'll be showing many of the things I've documented on this blog; if you're in the area, and not inclined to wreck anything I'm displaying, drop by and say hi. Watch out for one last hack to be posted in the next few weeks; it's one of my favourites and almost complete.)


  1. A couple of quick notes on how this works: MIDI sends a clock tick along (apparently 24 of these per quarter note, so depending on what the brain's tempo is set on). Whenever one of these ticks comes up I look at the status of each of the triggers, which will have been collected in a buffer in the meantime.

    If any of the triggers have crossed the "stroke threshold", i.e. been hit sufficiently hard, then we collect them into a list. If a number of ticks have passed since we started collecting them (currently 5 ticks) we will have collected a "sentence", which should describe a sequence we want to decode.

    The recognized sentences are defined in the "map" array in the code. Note that capital letters are repetitions of the same code for lower-case letters; play it once for a lower-case, play it twice in rapid succession for a capital.

    The sequences were thrown together from a combination of inspirations: morse code (e.g. T and E being a single trigger each), the shapes of the letters (e.g. the pads used mimic the edges of the V and W characters), keyboard in-jokes (e.g. the spacebar is the bass drum pedal), and even a few sound-puns (S is two symbals, T is the hi-hat; think bump-tiss-bump-tiss-bump-tiss).

  2. anyone know a way I can do this using a piano?

  3. Ajay: You could adapt this source code pretty directly; same as this project, all you need is a MIDI keyboard and some kind of MIDI/USB interface for your computer. You'd just need to code in more keys. Chording could still be useful, though you might have enough keys to work to make it unnecessary. I'm thinking single note for letter, major chord for capital, accent grave minor, acute accent seventh, ...

    Or, you could do what a friend of mine has long dreamed of doing -- using the three foot pedals for Control, Shift, and Alt.


Note: Only a member of this blog may post a comment.