Meta events carry what a MIDI file needs but a MIDI cable does not: names, words, the tempo, the time and key signatures and the end of each track. They are never sent to a synthesiser. In an RMI file they are part of the MIDI file in the data chunk; the text in the LIST INFO chunk is separate and can say the same things again. Each one is
FF <type> <length> <data>
where the type is one byte, 00 to 7F, and the length is a
variable-length quantity. A meta
event cancels running
status.
Types
| Type | Name | Length | Data |
|---|---|---|---|
00 | Sequence number | 2 or 0 | u16 |
01 | Text | any | text |
02 | Copyright notice | any | text |
03 | Sequence or track name | any | text |
04 | Instrument name | any | text |
05 | Lyric | any | text |
06 | Marker | any | text |
07 | Cue point | any | text |
08 | Program name | any | text |
09 | Device name | any | text |
0A–0F | Text, reserved kinds | any | text |
20 | MIDI channel prefix | 1 | channel |
21 | MIDI port | 1 | port |
2F | End of track | 0 | none |
51 | Set tempo | 3 | u24 |
54 | SMPTE offset | 5 | hr mn se fr ff |
58 | Time signature | 4 | nn dd cc bb |
59 | Key signature | 2 | sf mi |
7F | Sequencer specific | any | manufacturer ID, then data |
Numbers in meta events are big-endian, like the rest of the MIDI file. When an event has a fixed length and the file gives a different one, the explorer shows its bytes without decoding them.
Sequence number (00)
A 16-bit number that identifies the sequence: in a type 2 file, the pattern; in other types, the song. It must come first in its track, at time 0. With a length of 0 and no data, the number is the track’s place in the file.
Text (01)
Any text: comments, notes about the song, or anything else. Types 0A to
0F are reserved for further kinds of text and are read as text too.
The MIDI specification does not fix an encoding. Most files are ASCII; Windows-1252
and, in Japanese files, Shift JIS are also common. In an RMI file that follows SF2
RMIDI, the INFO entry MENC
gives a hint for the encoding of these text events. The explorer shows text as
Windows-1252. Many writers end text with a zero byte, as C strings do; readers drop it.
RP-026 later defined a way to state the language and encoding of text; its details were
not checked for this page.
Karaoke files put the words of the song in Text events, usually in a track named
“Words”. Texts that start with @ carry information:
@KMIDI KARAOKE FILE, @V a version, @I
information, @L the language and @T title lines. Within the
words, \ starts a paragraph and / a new line. This is a
convention, not part of the specification; see the
MIDI karaoke file. From a real MIDI file, in a
track named “Words”:
00 FF 01 13 40 4B 4D 49 44 49 20 4B 41 52 41 4F 4B 45 20 46 49 4C 45
Delta 0, Text, 19 bytes: @KMIDI KARAOKE FILE.
Copyright notice (02)
A copyright notice, such as “(C) 2000 Name”. It belongs in the first track, at time
0. An RMI file can also carry one in the INFO entry ICOP.
Sequence or track name (03)
The name of the track. In a type 0 file, or the first track of a type 1 file, it names
the whole song; an RMI file can also carry a title in the INFO entry
INAM. From the start of a real MIDI file’s first track:
00 FF 03 1B 5A 6F 6D 62 69 65 …
Delta 0, Track name, 27 bytes: Zombie Nation-Kernkraft 400.
Instrument name (04)
The instrument meant to play the track, as text, such as “Piano”. It does not choose the sound; a program change does.
Lyric (05)
One syllable or word of the lyrics, at the time it is sung. Karaoke files more often use Text events for the words.
Marker (06)
The name of a point in the song, such as a rehearsal letter or “Verse”. It belongs in the first track of a type 1 file.
Cue point (07)
A description of something that happens on stage, on screen or in the film at this point.
Program name (08)
Added by RP-019 in 1998. The name of the program chosen by the bank select and program change that follow.
Device name (09)
Added by RP-019 in 1998. The name of the device, or port, the track plays on.
MIDI channel prefix (20)
One byte, a channel 0 to 15. The meta and system exclusive events that follow, up to the next channel message, belong to that channel.
MIDI port (21)
One byte, the output port the track plays on. It is not in the specification, but many sequencers write it, and it is common in MIDI files. Some sources call it obsolete, in favour of the Device name event; that was not checked.
End of track (2F)
FF 2F 00, with no data. It is required as the last event of every track;
see End of track on the
tracks page.
Set tempo (51)
Three bytes, a 24-bit big-endian number: microseconds per quarter note, from this point on. Beats a minute = 60,000,000 ÷ tempo. Until the first one the tempo is 500,000, 120 beats a minute. In a type 1 file tempo events belong in the first track.
00 FF 51 03 0D 14 37
From a real MIDI file: 0D 14 37 is 857,143 µs a quarter note, 70 beats a
minute. How ticks become seconds is shown under
Timing.
SMPTE offset (54)
Five bytes, the SMPTE time at which the track starts. It belongs at the start of the track, before any event with a delta time above 0.
| Byte | Name | Meaning |
|---|---|---|
| 0 | hr | Hours |
| 1 | mn | Minutes |
| 2 | se | Seconds |
| 3 | fr | Frames |
| 4 | ff | Hundredths of a frame |
00 FF 54 05 60 00 03 00 00
From a real MIDI file, at time 0 in the first track. The hour byte, 60,
only makes sense in MIDI Time Code’s encoding, where bits 5 and 6 give the frame rate
(0 = 24, 1 = 25, 2 = 29.97 drop-frame, 3 = 30) and bits 0 to 4 the hours: here 30 frames
a second, 0 hours, 0 minutes, 3 seconds and 0 frames. The explorer reads it that way.
Whether the specification says the hour byte carries the frame rate is unconfirmed.
Time signature (58)
| Byte | Name | Meaning |
|---|---|---|
| 0 | nn | The numerator: beats in a bar |
| 1 | dd | The denominator as a power of two: 2 is a quarter note, 3 an eighth |
| 2 | cc | MIDI clocks per metronome click; there are 24 MIDI clocks in a quarter note |
| 3 | bb | Thirty-second notes in a MIDI quarter note (24 MIDI clocks), normally 8 |
00 FF 58 04 04 02 18 08
From a real MIDI file: 4/4, a click every 24 clocks (every quarter note), 8
thirty-second notes to a quarter note. 6/8 with a click on every dotted quarter would
be 06 03 24 08.
Key signature (59)
| Byte | Name | Meaning |
|---|---|---|
| 0 | sf | Signed: −7 to −1 is that many flats, 0 is none, 1 to 7 that many sharps |
| 1 | mi | 0 major, 1 minor |
sf | Major | Minor | sf | Major | Minor |
|---|---|---|---|---|---|
−7 (F9) | C♭ | A♭ | 1 | G | E |
−6 (FA) | G♭ | E♭ | 2 | D | B |
−5 (FB) | D♭ | B♭ | 3 | A | F♯ |
−4 (FC) | A♭ | F | 4 | E | C♯ |
−3 (FD) | E♭ | C | 5 | B | G♯ |
−2 (FE) | B♭ | G | 6 | F♯ | D♯ |
−1 (FF) | F | D | 7 | C♯ | A♯ |
| 0 | C | A |
00 FF 59 02 00 00
From a real MIDI file: C major.
Sequencer specific (7F)
Data for one maker’s software: a manufacturer ID, one byte or 00 and two
more, as in system exclusive
messages, then that maker’s own bytes. Other readers skip it.
Unknown types
A reader must ignore a meta event whose type it does not know, using the length to skip it. This is what lets new types, such as 08 and 09, be added without breaking older readers. The explorer shows unknown types with their bytes.