MP3 to MIDI SysEx Events: How One Message Is Split Into Records
A system exclusive message is the one part of MIDI whose content is not standardised: a manufacturer's own bytes wrapped in F0 and F7. The file cannot store it as a message, only as one or more records, each opening with a byte count. The split keeps timing; it is not a size limit.
Short answer
- The wire has no length field. A sysex ends when F7 arrives; nothing states in advance how long it will be.
- The file puts the count first. An F0 record's length excludes the F0 and the length byte itself, so a six-byte message occupies seven bytes.
- Packets are about timing. The format splits a dump into an F0 record and a run of F7 records so the gaps between groups survive. No size rule forces the split.
- The writer adds a terminator. A stored message must end with F7 even when the device never sent one.
On the wire, a sysex ends with a byte
A sysex opens with F0, carries a seven-bit manufacturer code, usually one byte, then whatever the manufacturer defined, and closes with F7. A receiver that does not recognise the code ignores the rest. There is no length field: the end is the terminator, which a reader must scan for.
In the file, a sysex begins with a count
A complete message is stored in one record: F0 <length> <bytes to be transmitted after F0>. The length counts what follows it, excluding the F0 and the length byte itself; a payload of up to 127 bytes costs one length byte. The specification's example, F0 43 12 00 07 F7 on the wire, is stored as F0 05 43 12 00 07 F7: six bytes become seven.
The second form carries the rest
The other record is written F7 <length> <all bytes to be transmitted>. It does not imply an F0, and the F7 that opens it is not part of the message. So the first packet of a split message uses F0, the rest F7.
Why a message gets split at all
Some manufacturers send a dump as small packets. The specification says the times they are transmitted are important, and offers the two forms together to preserve those intervals. The split is a timing device: the length field reaches 268,435,455 bytes, so size is not what forces it.
What the split costs
The worked example sends F0 43 12 00, waits 200 ticks, sends six more bytes, waits 100 ticks, then sends four ending in F7. That is fourteen bytes of traffic and twenty-two in the file: six of record headers, three of delta-time, and the F0 implied rather than stored, so 14 + 6 + 3 - 1 = 22.
The terminator the writer adds
A stored message must end with F7 even when the device never sent one, so a reader need not look ahead. The file can hold a byte that never crossed the wire.
Reading one is stateful
An F7 record with no open F0 before it is read as an escape, not a continuation, so one byte means continuation or escape according to what came earlier. No transmittable event may sit between packets, which is stricter than the wire, where only real-time messages may be interleaved.
What this means for a converted file
None of the four requirements for a General MIDI Level 1 instrument mentions a sysex: 24 voices, response to velocity, all 16 channels, polyphony on each. A converter can write a conforming file with no sysex at all. General MIDI names two sysex messages, one to enable and disable compatibility and one for master volume, but gives no bytes for either. If a converted file contains an F0 record, it is a reset or a patch dump: it carries no note number, velocity or duration, and changes how later notes sound rather than stating one.