Expand description
Song Position Pointer (SPP) — 14-bit MIDI-beat position codec.
SPP is the System Common message 0xF2 LSB MSB: two 7-bit data bytes form a
14-bit value counting MIDI beats from the start of the song, where one
MIDI beat = 6 MIDI clocks = a sixteenth note. The value range is
0 ..= 16383. This module encodes a beat count into the two data bytes
(least-significant 7 bits first) and decodes them back, validating that the
data bytes have their high bit clear. Allocation-free.
Constants§
- MAX_
BEATS - Maximum representable MIDI-beat position (14 bits).
- SONG_
POSITION - Song Position Pointer status byte (System Common).
Functions§
- decode_
song_ position - Decode the two SPP data bytes back into a MIDI-beat position.
- encode_
song_ position - Encode a MIDI-beat position into the two SPP data bytes
[LSB, MSB].