MP3 to MIDI: Seven Text Slots, Ninety-Five Characters

A converted .mid can carry words, but only in seven defined slots and only out of an alphabet of ninety-five printable characters. None of the seven touches a note, a velocity or a tick, so a converter that writes no text still produces a file that plays the same.

Short answer

  • Seven slots, fifteen codes. Meta types 01 through 0F are reserved for text events; only 01 to 07 are named. leaving eight undefined.
  • Ninety-five characters. The payload is specified as printable ASCII: 95 of the 256 byte values, or 37.1%.
  • The copyright slot spells out (C). Three characters, not the single sign, which sits above the ASCII range.
  • Zero musical effect. Delete every text event and the note list is unchanged.

Seven names and eight blanks

Text Event is FF 01, Copyright Notice FF 02, Sequence/Track Name FF 03, Instrument Name FF 04, Lyric FF 05, Marker FF 06, Cue Point FF 07. One sentence then fixes the size of the family: meta-event types 01 through 0F are reserved for various types of text events. Fifteen codes, seven names, eight left blank. All seven share one shape, the FF byte, a type byte, a length and then the bytes, so the type byte is the only thing separating a lyric from a copyright notice. Sequence Number and Sequence/Track Name, if present, must appear at time 0, though events sharing a time may occur in any order.

Ninety-five characters out of 256

The specification asks for printable ASCII characters for maximum interchange. A byte holds 256 values; printable ASCII runs from 0x20 to 0x7E, which is 95 of them, 37.1%, leaving 161 control and high-bit values. High-bit characters are permitted, but only for interchange between programs on the same computer, and a reader without that support is told to ignore those characters rather than reject the file. A title with an accent can arrive shorter than it left, and nothing records what went missing.

Why the copyright slot spells out (C)

The Copyright Notice holds a copyright notice as printable ASCII text, and should contain the characters (C), the year and the owner. The plural is the point: three characters, not one. The copyright sign is U+00A9, byte 0xA9 in Latin-1, high bit set, outside the ninety-five. The one slot written for a legal notice is written around the fact that the symbol does not fit. Jukeblocks' MP3 tag editor page notes that ID3v2 “supports Unicode characters for non-Latin scripts”, so a title that survives in an MP3 tag can lose characters inside a .mid.

Only one slot is timed like music

Six of the seven are labels pinned to a position. Lyric is a sequence: generally each syllable will be a separate lyric event which begins at the event's time. The syllable count becomes an event count, and every event pays three bytes before the first character: FF, the type, one length byte for text of 127 bytes or less. A one-letter syllable is four bytes, three of them bookkeeping, or 75%. A four-letter syllable is seven bytes, 43%.

What this means for the file you downloaded

If your DAW shows a track name and the file holds no FF 03, that name did not come from the file. Nothing obliges a converter to write any of the seven; the single event the specification calls not optional is End of Track. Text is the cheapest thing to add and the easiest to skip.

How to read the text that is there

Open the file in a hex viewer and look for 0xFF followed by a type byte in 0x01 to 0x07. Each hit is one of the seven slots; the byte after the type is the length. A file with no such pair carries no words, whatever your DAW displays.

Related