A MIDI message is a sequence of bytes sent to a MIDI device to prompt it to do something.
The status byte of a MIDI message is the first byte of the MIDI message, the value of which defines the type of the MIDI message and shows the receiving MIDI device what to do and how to interpret the rest of the bytes in the message.
The following are possible status bytes.
|Status byte||MIDI message||MIDI message category||MIDI device action|
|0x80 to 0x8F||Note off||Voice||Release a note and stop playing it|
|0x90 to 0x9F||Note on||Voice||Play a note and start sounding it|
|0xA0 to 0xAF||Aftertouch / key pressure||Voice||Apply pressure to a note playing, similar to applying pressure to electronic keyboard keys|
|0xB0 to 0xBF||Controller||Voice||Affect a controller, such as a slider, knob, or switch|
|0xC0 to 0xCF||Program change||Voice||Assign a program to a MIDI channel, such as an instrument, patch, or preset|
|0xD0 to 0xDF||Channel pressure||Voice||Apply pressure to a MIDI channel, similarly to applying pressure to electronic keyboard keys|
|0xE0 to 0xEF||Pitch / modulation wheel||Voice||Change a channel pitch up or down|
|0xF0||System exclusive (sysex) message||System common||Perform some device specific task|
|0xF1||MIDI time code quarter frame||System common||Set the MIDI time to keep in line with some other device|
|0xF2||Song position pointer||System common||Cue to a point in the MIDI sequence to be ready to play|
|0xF3||Song select||System common||Set a sequence for playback|
|0xF6||Tune request||System common||Tune|
|0xF8||MIDI clock||System real-time||Understand the position of the MIDI clock (when synchronized to another device)|
|0xFA||MIDI start||System real-time||Start playback of some MIDI sequence|
|0xFB||MIDI continue||System real-time||Resume playback of some MIDI sequence|
|0xFC||MIDI stop||System real-time||Stop playback of some MIDI sequence|
|0xFE||Active sense||System real-time||Understand that a MIDI connection exists (if there are no other MIDI messages)|
|0xFF||Reset||System real-time||Reset to default state|
Messages with status bytes 0x80 to 0xEF are channel specific. In their status bytes, the high nibble of the byte specifies the status and the low nibble specifies the channel. For example, the status byte 0x92 tells the receiving MIDI device to play a note on channel 2.
Status byte 0xFF
Sent over MIDI ports, the 0xFF status byte describes a "reset" message. The MIDI device that receives this message will reset itself to a default state, which usually means stopping all playback, resetting the song position to zero, and so on.
In a MIDI file, however, the 0xFF status byte means a "meta" message. Meta messages carry meta information about the MIDI song, including track names, end of track messages, various text messages, and other.
"Reset" messages and "meta" messages are completely different, even though they have the same status byte. One can distinguish between the two, however. The reset message is sent over MIDI ports and is usually user generated (e.g., by pressing a button, rather than stored in a MIDI song). The meta message is stored in MIDI files, but never sent over MIDI ports.
MIDI running status
A MIDI device remains in its status until a message with a new status is received. The MIDI protocol permits that, if the two or more consecutive messages have the same status byte, the status bytes of the second, third, and so on messages can be omitted. This reduces the amount of data that must be sent. If a new message has a different status byte, then that status byte must be present to notify the receiving device of the new status.
The status byte can similarly be omitted from consecutive messages with the same status byte when MIDI data is stored in a MIDI file.
Most commonly, after sending a note on message with some velocity to play a note, MIDI devices can send another note on message, but with zero velocity to turn off that same note. The status byte of the second note on message can be omitted as it is the same as the status byte of the previous note on message (assuming there are no messages in between).
The MIDI device will know that a status byte is omitted as status bytes have values between 0x80 and 0xFF and a most significant bit of 1, whereas other data bytes in the messages are between 0x00 and 0x7F and have a most significant bit of 0.