Pure Data, Android audio, and random stuff

Noisepages: Websites for smart artists.

MIDI over Bluetooth

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.


12 Responses

  1. [...] again, my initial experiences with my own MIDI over Bluetooth setup have been rather promising. I never noticed any major latency, but then again, I haven’t yet [...]

  2. [...] you are tempted to build your own MIDI-Bluetooth interface but were deterred by the price tag of the BlueSMiRF Bluetooth modem, here’s your [...]

  3. [...] I started thinking about MIDI and Bluetooth, my first idea was to connect an Arduino to a MIDI device on one side and to a Wiimote on the [...]

  4. Stan

    Hi Peter, this is Brilliant! I am trying to connect my wife’s midi keyboard to her macbook air so that she can input midi into Sibelius scoring program.
    Can this work with a Mac? With core midi?
    Can you detail how to do this? I used to build circuits in High School – Many years ago – but would give this a try. 
    Simply Brilliant!
    How about a USB version? (as in  - a usb keyboard to this adaptor)
    Thanks much…

  5. Peter Brinkmann

    Hi Stan,
    About Macs: Off the top of my head, I can think of two approaches. It may be possible to map the Bluetooth connection to a serial device and then use a serial MIDI converter to exchange events with CoreMIDI.

    If that doesn’t work, you could write a small program that talks to Bluetooth on one side and CoreMIDI on the other. You can take a look at BluetoothMidiService.java to get an idea how such a program might look.

  6. Peter Brinkmann

    Hi Stan,
    I just realized that I didn’t answer the second part of your question, about connecting USB keyboards to this adapter.  That would require a lot more processing in the adapter itself, and I don’t think it would be worth the effort.

    If I were to build a wireless solution for USB keyboards, I would probably take a small Linux machine (e.g., gumstix) and use it as a bridge between USB MIDI and WiFi, using the new MIDI HD protocol.

  7. [...] In his first blog post, he describes his hardware setup. (He later updated the rig and moved it off the bread board. [...]

  8. [...] original version used a BlueSMiRF module, which is great for prototyping because it’ll accept voltages between [...]

  9. [...] In his first blog post, he describes his hardware setup. (He later updated the rig and moved it off the bread board. [...]

  10. [...] thrilled to announce that we’re getting closer to turning the Bluetooth MIDI interface into a kit. Andrew Tergis of Bug Labs designed a really nice printed circuit board, and it works, [...]

  11. [...] d) Use the continuous MIDI data flowing from strings 1-6 over pins 1-6 using a one for one MIDI to wireless serial or bluetooth 2.1 adapter (such as the one found here or here). [...]

  12. [...] for a Sheet Music Reader App… Need Advice!! Pro Audio software for Android external links: MIDI over Bluetooth, Part I: Hardware The Missing Link : Jabrudian Industries LLC Golden Age of Wireless: Korg iOS Sync, Android + MIDI [...]

Leave a Reply