Monday, October 1, 2012

USB MIDI Drums Android

As the USB OTG functionality of my Samsung Galaxy S II works again due to the recent update to 4.0.4, I finally was able to test my phone with multiple USB devices. After successfully trying a mouse, keyboard and flash drive, I tried a MIDI USB interface together with a BandHero drum kit.

I downloaded a USB MIDI Monitor app and found out that the phone was able to receive the signals sent by the drum kit and continued searching the Play Store for an app that was able to play the suitable drum sound accordingly to the input signals.
I did not find one, so I quickly asked Google for any available open source basis and really found something:

After downloading the demo application, it soon seemed clear that there was not much more work to do to implement a simple USB MIDI drum kit app.
Actually, only the sounds part was left, which was easily implemented after I had found this post from a  countryman of mine. A web search led me to some drum kit wave files, I adjusted the code a bit to allow for a variable volume of the sounds according to the beat velocity and finally had a (more or less) useable app.

Here is the resulting app: (APK, 0.8 MB)
EDIT: Please note that only the MIDI notes the BandHero drum kit sends are assigned to sounds, so this app will most likely not work if you try it with another drum kit.

Basically, I've just merged components created by other people, but I hope it's of some use for someone.

Don't be surprised if you don't see an icon in the launcher after installing the app. It only has one activity that launches when you connect a USB device through an USB OTG cable to your device.
Moreover, I have not adjusted the user interface nor the bundle name of the USB-MIDI-Driver sample app, so you won't get any hints or settings concerning the drum kit.

PS: I quickly found out that Android is not really suitable for real time audio (yet), but that's another story.