A little while ago, I added MIDI support to libpd because CoreMIDI is available in the latest version of iOS. I wasn’t too thrilled about this, not just because I’m no fan of MIDI but also because Android currently doesn’t support MIDI. So, I decided to add MIDI capabilities to Pd-for-Android.
Simply plugging in a USB MIDI keyboard was not an option because stock Android devices don’t support USB host mode without hacks and besides, tethering a phone to a big chunk of hardware seems antithetical to mobile devices. Bluetooth seems like the way to go, but a quick search turned up relatively little useful information, and no commercial interface for transmitting MIDI over Bluetooth. Maybe that means that Bluetooth is not a good medium for MIDI, but I figured I’d give it a try anyway.
The hardware is perfectly straightforward. There’s no shortage of schematics for MIDI interfaces on the web; I followed Lady Ada’s excellent instructions, with a few minor modifications:
- Instead of an Xbee radio, I used a BlueSMiRF Bluetooth modem.
- Instead of a 74HC04 hex inverter, I used a CD4049UBE hex inverter because I happened to have one lying around.
- The BlueSMiRF seemed a bit unstable with four batteries, even though the specs say that it can take an operating voltage of up to 6V. I switched to three AAA batteries and haven’t had any trouble since.
- I left the shield of the MIDI In socket unconnected in order to avoid ground loops.
One of the great features of the BlueSMiRF modem is that it is easy to set up and capable of handling the nonstandard MIDI bit rate. In order to configure it for MIDI, connect a Bluetooth terminal (such as BlueTerm for Android) to the modem and enter the following incantation:
You need to do this within 60 second after switching the BlueSMiRF on. After a reboot the modem will be ready to transmit MIDI messages.
I haven’t yet had the chance to evaluate jitter and latency for this setup. It probably won’t be accurate enough for all musical applications, but I figure it’ll still be useful. At some point, I’ll probably use it for transmitting measurements from a Doepfer Pocket Electronic. For the time being, in any case, this rough proof of concept is working nicely.