MIDI meta messages

According to the MIDI protocol certain MIDI events are never sent over MIDI ports, but exist in MIDI files. These events are called meta events and the messages that they carry are called meta messages.

MIDI meta messages are messages that contains information about the MIDI sequence and that are not to be sent over MIDI ports.

Meta messages have the following standard structure.

Field Length Starts at byte Value
Status byte One byte 0x00 0xFF always
Meta type One byte 0x01 Variable, see below
Length Variable 0x02 0-255
Data Variable 0x03 variable

Status byte – the first byte of the MIDI meta message is the "status byte" as with any other MIDI message. The status byte of a MIDI meta message is always 0xFF.

Meta type – the "meta type" byte defines how the rest of the message should be interpreted (see below for a table of defined meta types).

Length – the "length" contains the length in bytes of the data to follow so that MIDI devices know how much data to expect (not including the status byte, meta type, and the length itself). The length of certain meta messages (see below) is predefined, whereas other meta messages have variable length. The length itself is a variable-length quantity (for an example of a variable-length quantity in MIDI, see the description of delta time in the topic MIDI event).

Data – the "data" portion of the message defines, obviously, something that the MIDI device must interpret.

The following is a list of defined meta messages.

Message Meta type Data length Contains Occurs at
Sequence number 0x00 2 bytes The number of a sequence At delta time 0
Text 0x01 variable Some text Anywhere
Copyright notice 0x02 variable A copyright notice At delta time 0 in the first track
Track name 0x03 variable A track name At delta time 0
Instrument name 0x04 variable The name of an instrument in the current track Anywhere
Lyrics 0x05 variable Lyrics, usually a syllable per quarter note Anywhere
Marker 0x06 variable The text of a marker Anywhere
Cue point 0x07 variable The text of a cue, usually to prompt for some action from the user Anywhere
Channel prefix 0x20 1 byte A channel number (following meta events will apply to this channel) Anywhere
End of track 0x2F 0   At the end of each track
Set tempo 0x51 3 The number of microseconds per beat Anywhere, but usually in the first track
SMPTE offset 0x54 5 SMPTE time to denote playback offset from the beginning At the beginning of a track and in the first track of files with MIDI format type 1
Time signature 0x58 4 Time signature, metronome clicks, and size of a beat in 32nd notes Anywhere
Key signature 0x59 2 A key signature Anywhere
Sequencer specific 0x7F variable Something specific to the MIDI device manufacturer Anywhere

Note on status byte 0xFF

The reset message (a system realtime message) carries the same status byte as a meta message: 0xFF. By convention, the MIDI reset message is never placed in MIDI files but is only sent over MIDI ports upon a request by the user. Thus, if a MIDI device receives the status byte 0xFF over a MIDI port, the device will interpret it as a "reset" message. If the MIDI device reads the status byte 0xFF from within some MIDI file, the device will interpret the message as a meta message.

Note on meta types

Since all meta message have the same status byte (0xFF), the MIDI meta type ensures that MIDI devices can distinguish between different meta messages. For example, if the meta type in the second byte of a meta message is equal to 0x02 then the message contains a copyright notice (see the table above).

See also:
Musical Instrument Digital Interface (MIDI)


admin: First posted on 2011 01 13

Simon, 2011 01 13: This is great information, thank you very much! It was exactly what I need and in all the detail I needed. Great good :)

The length field, the 3rd field, is stored as a variable-length quantity and varies from 1 to 4 bytes.

You are right and a variable-length quantity makes sense. The topic will be fixed.

Add new comment

Filtered HTML

  • Freelinking helps you easily create HTML links. Links take the form of [[indicator:target|Title]]. By default (no indicator): Click to view a local node.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Enter the characters shown in the image.