Musical Instrument Digital Interface (MIDI)

Musical Instrument Digital Interface, or simply "MIDI", is a set of hardware requirements and a protocol that electronic devices use to communicate and store data (i.e., it is a language, file format, and hardware specifications), specifically designed for storing and transferring digital representations of music.

MIDI messages

According to the MIDI protocol, MIDI devices communicate by sending each other MIDI messages. MIDI messages are sequences of bytes that tell receiving devices to do something. For example, the following sequence of three bytes is one possible message.

0x90 0x26 0x3C

The first byte is 0x90. The 9 tells the receiving device to play a note and 0 specifies that the note should be on channel 0. The note is 0x26, which is the note D in the third or so octave from the bottom. The velocity (e.g., volume) with which the note should be played is 0x3C, which is about middle. Thus, this message tells the device to start playing the note D on channel 0 with medium volume. Examples of other MIDI messages exist in the topics below.

Status byte and data bytes of MIDI message

The first byte in a MIDI message is its status byte. The remaining bytes are the message data bytes.

In the example above, the status byte is 0x90 and the data bytes are 0x26 0x3C.

  • Status bytes have values between 0x80 and 0xFF. Their topmost bit in binary form is 1.
  • Data bytes have values between 0x00 and 0x7F. Their topmost bit in binary form is 0.

See Status byte (of a MIDI message) for a list of possible status bytes and their interpretation. See the topics below for descriptions of the data bytes in each message type and for examples.

The status byte describes what the device should do and what follows the status byte. The status byte 0x90, for example, states that this is the MIDI Note On message for channel 0. It tells the receiving device to play a note on channel 0. With this status byte, the receiving device will expect two more data bytes. The first byte to follow with tell the device which note to play. The last byte will tell the device the velocity (e.g., volume) of the note.

Most MIDI messages consist of one status byte and one or two data bytes. MIDI System Real-time messages are exception. For example, the MIDI Start message consists only of a status byte and has no data bytes. It tells the device to start playback. MIDI System Exclusive messages are also an exception. They can contain more than one or two bytes after the status byte.

MIDI running status

When messages are transmitted to a MIDI device and when messages are stored in MIDI files as described below, the status byte can be omitted if it is the same as the previous status byte.

For example, if one message asked the receiving device to play a note on channel 0 (status byte 0x90) and the next message also asks the device to play a note – same or different – on channel 0 (same status byte of 0x90), then the second status byte can be omitted. In this example, the receiving device will know that the first message is completed after it receives a total of three bytes (the status bytes and the two data bytes of the MIDI Note On message). The device will also know that the next message is missing a status byte, as status bytes are between 0x80 and 0xFF, whereas the remaining MIDI data bytes are between 0x00 and 0x7F.

This omitting of the status byte is known as the MIDI "running status". The status of the MIDI receiving device will remain the same until a new status is received.

Types of MIDI messages

MIDI messages are sent over 16 channels. There are two types of messages: channel messages and system messages.

  • Channel messages are specific to a channel. The four top bits of their status byte define what the receiving device should do (e.g., 9 to play a note as in the example above) and the bottom four bits of the status byte define the channel (e.g., 0 for channel 0 as in the example above). Channel messages can be voice messages (e.g., play a note) and mode messages (e.g., choose an instrument).
  • System messages are not specific to a channel and their status bytes do not define a channel. They can be common (e.g., que to a specific point in the MIDI sequence to prepare to play), real-time (e.g., start playback), and exclusive (e.g., do something specific to that device).

The MIDI protocol notes that a MIDI receiver will receive its main instructions (e.g., channel mode messages) on one channel, called its basic channel and should ignore such messages that are sent to other channels. A transmitter thus can select which receiver is to receive such messages.

When a MIDI receiver has multiple instruments, it may have more than one basic channel and can therefore act as several MIDI receivers.

Channel voice messages, on the other hand, may be sent on all channels, including the basic channel.

See Status byte (of a MIDI message) for a list of channel voice, system common, and system real-time messages. Channel mode messages are technically control change messages, but with controller values of 120-127. Control change messages with other controller values are considered channel voice messages. System exclusive messages are sometimes listed as system common messages.

MIDI file format

The MIDI file format defines that MIDI files are organized in chunks. Each file starts with a header chunk and can contain one or more track chunks. The header chunk contains information that describes the whole MIDI file, such as the time division of the file or the number of track chunks in the file. The track chunks contain the messages of the MIDI language.

Note that the MIDI file is not a subtype of RIFF files. The MIDI header chunk and track chunks are the top-level chunks in the MIDI file. In contrast, the wave file format is an extension of the RIFF file format and the top-level chunk of a wave file is the RIFF chunk. Nevertheless, the MIDI chunks have a similar structure to the RIFF and wave chunks.

MIDI hardware specifications

There are a number of hardware specifications for MIDI. For example, the MIDI connectors are 5 pin DIN (i.e., standardized by Deutsches Institut für Normung). Cables are shielded twisted pairs. Pin 1 is not used. Pin 2 connects the shield. Pin 3 is not used. Pin 4 and 5 connect the twisted pair cables. MIDI devices use separate jacks for input and output, which are both female. The MIDI electronics use current loops (i.e., where signaling is done through electric charge / current and not through voltage) and use optoisolators that respond within 2 microseconds. The circuit itself runs the current loop at 5 mA and current is on for transistor-resistor logic 0.

MIDI standards

Not all MIDI devices satisfy all MIDI requirements (specifically, not all devices understand all of the MIDI language). There are currently three levels of standards. Earlier devices satisfied a subset of the MIDI requirements described above, which was called General MIDI Level 1 (GM1). In 1999, this subset was expanded to include more of the MIDI language specifications and was called General MIDI Level 2 (GM2). A recent standard for mobile MIDI communications is called General MIDI Lite (GM Lite). The standard Scalable Polyphony MIDI (SP-MIDI) describes how the GM2 standard should be scaled down to GM1 or to GM Lite, if music in GM2 is to be sent to GM1 or GM Lite devices.

MIDI related topics

The following are topics on MIDI in alphabetical order.

Format type (of a MIDI file)
General MIDI 1
General MIDI 2
General MIDI System Enable / Disable message
Header chunk (of a MIDI file)
MIDI Active Sense message
MIDI Channel Prefix meta message
MIDI Channel Pressure message
MIDI Clock message
MIDI Continue message
MIDI Controller Destination message
MIDI Controller message
MIDI Copyright Notice meta message
MIDI Cue Point meta message
MIDI End of Track meta message
MIDI Full Frame message
MIDI Global Parameter Control message
MIDI Instrument Name meta message
MIDI Key-Based Instrument Controller message
MIDI Key Pressure message
MIDI Key Signature meta message
MIDI Lyrics meta message
MIDI Marker meta message
MIDI Master Volume message
MIDI meta messages
MIDI Note Off message
MIDI Note On message
MIDI Pitch Wheel message
MIDI Program Change message
MIDI Quarter Frame message
MIDI Registered Parameter Number (RPN)
MIDI Reset message
MIDI Sequence Number meta message
MIDI Sequencer Specific meta message
MIDI Set Tempo meta message
MIDI SMPTE Offset meta message
MIDI Song Position Pointer message
MIDI Song Request message
MIDI Start message
MIDI Stop message
MIDI system common messages
MIDI System Exclusive message
MIDI system real-time messages
MIDI Text meta message
MIDI tick
MIDI Time Signature meta message
MIDI Track Name meta message
MIDI Tune Request message
MIDI voice messages
Status byte (of a MIDI message)
Track chunk (of a MIDI file)
Time division (of a MIDI file)

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.