Why MIDI Data Bytes Have Their MSB Set to Zero
In the MIDI (Musical Instrument Digital Interface) specification, data bytes always have their Most Significant Bit (MSB) set to zero to distinguish them immediately from status bytes, which always have their MSB set to one. This single-bit flag system allows receiving hardware to instantly differentiate between a command (such as Note On or Note Off) and the parameters that follow it (such as pitch and velocity). This architectural choice provides robust stream synchronization, simple error handling, and support for bandwidth-saving features like running status over serial connections.
The MSB as a Type Identifier
MIDI communicates via an asynchronous serial stream of 8-bit bytes. Because data flows continuously as a single stream without external packet headers, the receiver must be able to parse the incoming stream reliably. The specification solves this by reserving the eighth bit (bit 7, the MSB) as a type flag:
- Status Bytes (MSB = 1): Binary
1xxxxxxx(Decimal 128 to 255, or0x80to0xFF). These bytes define the action to be taken and the target MIDI channel. - Data Bytes (MSB = 0): Binary
0xxxxxxx(Decimal 0 to 127, or0x00to0x7F). These bytes deliver the values associated with the preceding status command.
Instant Synchronization and Error Recovery
Because MIDI cables can be plugged, unplugged, or interrupted during active playback, bytes can occasionally be lost or corrupted. If both status and data bytes shared the same value range, a dropped byte would cause the receiving device to mistake a data value (such as a velocity of 64) for a status command, causing the parser to fall permanently out of alignment.
By setting the MSB of all data bytes to zero, the receiver can never misinterpret a data byte as a command. If a communication error occurs, the receiver simply ignores incoming data bytes until it detects a byte with an MSB of 1, instantly regaining synchronization at the start of the next valid command.
Enabling "Running Status"
The fixed MSB system enables "running status," an optimization rule designed to conserve bandwidth over MIDI's standard 31.25 kbaud serial line. Under running status, if a sequence of identical commands is sent (such as a passage of Note On messages), the sender transmits the status byte only once, followed by multiple pairs of data bytes.
Because the receiver knows that any byte with an MSB of zero is purely data, it automatically applies that data to the most recently received status byte. The stream of data bytes continues uninterrupted until a new status byte (with an MSB of 1) signals a change in command.
The 7-Bit Data Trade-off
Reserving the MSB limits MIDI data values to 7 bits, giving a range of 0 to 127. For musical performance, 128 discrete values are well-matched to human perception and standard instruments:
- 128 note numbers cover over 10 octaves, exceeding the range of an 88-key piano.
- 128 velocity levels provide sufficient dynamic variation for musical expression.
When higher resolution is necessary, such as for pitch bend or continuous controller automation, MIDI pairs two 7-bit data bytes together (a Most Significant Byte and a Least Significant Byte) to produce a 14-bit value with 16,384 distinct steps, maintaining the protocol's framing rules without sacrificing precision.