From Nordic: MIDI over Bluetooth LE
Useful Links
There is a ton of information out there that can be hard to filter. I wanted to share a few links that I found useful.
“An Intro to MIDI” by the MIDI association". This link gives a quick idea of what MIDI is and what it can do, but it can be skipped if you are only here for the BLE part.
“MIDI Code” by Juan P Bello. This link gives a great understanding of the lower level bits and bytes of MIDI protocol. (Similar pages can be found by the midi organization themselves.)
“MIDI BLE Tutorial” by Sparkfun. This is an excellent in-depth tutorial that leverages an Arduino library together with our very own nRF52.
“Bluetooth GATT: How to Design Custom Services & Characteristics [MIDI device use case]” A nice tutorial that talks about adding custom services. (However, there is no part of the BLE-MIDI protocol implemented apart from the characteristics themselves).
Topology of BLE-MIDI
We will not recall the entire BLE-MIDI specification here. But we will mention a few points.
The Service (MIDI Service) has one Characteristic (MIDI Data). A client can subscribe to notifications from the MIDI Data characteristic to receive BLE packets with MIDI messages from the server. A client can send MIDI messages to a server by writing to the MIDI Data characteristic.
MIDI would normally be a stream of messages, but Bluetooth LE is packet based with a minimum of 7.5 ms connection interval. The biggest modification BLE-MIDI makes to MIDI, is that timestamps are added to help interleave and deinterleave MIDI messages in this time sensitive protocol.
Each BLE-MIDI packet begins with a Header byte, and the different status bytes in the MIDI protocol must be prepended with Timestamp bytes. Inside a packet, time is a 13 bit variable, where Header contains the 6 most significant bits, and Timestamp contains the 7 least significant bits.
The BLE-MIDI service I implementation acts as a Server, and is used by the example application which is a Peripheral.
CLICK HERE TO KEEP READING
Source: https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/midi-over-bluetooth-le