Skip to main content

Module blemidi

Module blemidi 

Source
Expand description

BLE-MIDI packet framing (Apple / MMA “MIDI over Bluetooth LE” spec), used for the pedal’s Wireless mode. Pure code: the transport itself is in the engine (feature ble).

A packet is a header byte (1 0 t12…t7) followed by MIDI messages, each status byte preceded by a timestamp byte (1 t6…t0). SysEx may span packets: a continuation packet carries its data bytes straight after the header, and the closing F7 gets its own timestamp byte. Running status is allowed, with or without a fresh timestamp.

The pedal speaks exactly the USB-MIDI protocol over BLE (SysEx, CCs, PCs), only framed like this.

Structs§

Decoder
Turns BLE-MIDI packets back into whole MIDI messages, keeping SysEx and running status across packets.

Constants§

CHARACTERISTIC
MIN_PACKET
Packet payload size that every BLE link supports (ATT MTU 23 minus the 3-byte header).
SERVICE
The pedal’s GATT service and characteristic (the standard BLE-MIDI ones).

Functions§

encode
Frame whole MIDI messages into BLE-MIDI packets of at most max bytes (max ≥ 5), packing several messages per packet. ts_ms is the 13-bit millisecond timestamp (wraps).