Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MIDI Over Bluetooth

I'm starting a project featuring a wireless MIDI connection over Bluetooth. As far as I know, there is no MIDI profile defined in the BT specification.

I was wondering if some of you would be interested in sharing experience about the best way to use MIDI over BT, especially regarding latency issue.

My project is based on BT low energy (BTLE), I'm now trying to find the best BT profile to use, maybe the serial port RFCOMM existing profile, or a new custom profile ?

Any tip would be appreciated. Best Jerome

like image 281
Jerome Avatar asked Apr 16 '13 08:04

Jerome


1 Answers

Profiles like RFCOMM does not belong to BTLE but to the bluetooth classic.

In music applications you should care about latency. The time from first byte is send from a midi keyboard and until it arrives at the destination really matters. There is no exact BAUD rate in SPP / RFCOMM but throughput which depends on the 2 sides. http://snapshot.bluecove.org/bluecove-examples/bluecove-tester/speed.html

If you input MIDI (31250 BAUD), send it through a "channel", send it out through MIDI (31250 BAUD) then you need to look at 2 things: 1) Throughput, must be big enough to 'sink' and 'source' Midi In and Midi Out 2) Latency, must be fast enough to make it 'musically' accurate.

A Midi ON event takes aproximately 30 signal bits so you can send some 104 Midi events per sec. Latency is aprox 10ms.

On iOS the fastest Connection Interval (1 block of some 20 bytes) is around 19ms if you break the recommendations or 39ms if you follow them. The total latency would then be: Midi In (10ms) + BTLE GATT (up to 39ms) + Midi Out (10ms) = 60ms. 6 times slower than normal MIDI cable. Minimum BTLE connection interval is 7.5ms but you will lose packets at the lowest level so let's just say 10ms: Midi In (10ms) + BTLE (10ms) + Midi Out (10ms) = 30ms. Not too bad but not really impressive either. In each Connection Interval you can pack around 20 Bytes so there should be plenty of bandwidth or throughput.

Take a look at this BTLE RFCOMM project: http://support.connectblue.com/display/PRODBTSPA/Bluetooth+Low+Energy+Serial+Port+Adapter+-+Getting+Started

like image 172
henrik Avatar answered Nov 13 '22 06:11

henrik