MIDI Over Bluetooth
Asked Answered
B

1

6

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

Bankhead answered 16/4, 2013 at 8:42 Comment(0)
I
4

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

Interatomic answered 17/4, 2013 at 7:18 Comment(6)
MIDI latency on its own is more typically around 4-5ms. Most messages (note on/off) are 2 bytes. Controller messages are usually delayed by the sending device if there are notes to be sent.Hesson
"A Midi ON event takes aproximately 30 signal bits so you can send some 104 Midi events per sec. Latency is aprox 10ms." The writer slipped a decimal place - 31250bps/30b = 1041 Note-On events per second. HALBackward
@Brad: most messages (Note On/Off, Control Change, Pitch Bend, ...) are 3 bytes.Barograph
henrik and Brad: Sending one 3-byte messages over a standard MIDI cable takes 960us (matching @Hal's 1041 full Note messages per second), not 4-5ms. Of course, the receiver may add delay for processing.Barograph
For musical MIDI communication, not only 1) throughput and 2) latency are important, but also 3) jitter: how much the latency varies. A high latency can be tolerable if jitter is low. Jitter above a couple of milliseconds can seriously affect feel and rhythm of musical pieces.Barograph
nime.org/proceedings/2019/nime2019_paper006.pdf analysed the timings, very interesting as well.Tancred

© 2022 - 2024 — McMap. All rights reserved.