Electronic Music Interactive v2
Previous.Next.

37. MIDI Data

As noted in MUSICAL INSTRUMENT DIGITAL INTERFACE, a MIDI message is made up of digital data. This data, however, does not represent sound as it is discussed in DIGITAL REPRESENTATION OF SOUND. Instead, MIDI data is a stream of digital data (numbers) that, for the most part, carries information about a musical performance. This data is carried from component to component in a MIDI system to achieve the musical results determined by the user.

Earlier MIDI messages were described in terms such as "play note middle C and play it softly." This type of MIDI message is a very common one and provides a good beginning point for studying how MIDI messages are "coded."

The message in the phrase "play note middle C and play it softly" is conveyed by a sequence of letters that are grouped into words. MIDI messages work essentially the same way but with two important differences. First, computers and devices with microprocessors such as MIDI instruments count, but they don't spell. This means that all MIDI messages are sent as a series of numbers, not letters. Second, instead of using the letters of the alphabet, or even the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9, microprocessors use only two digits: 0 and 1.

But like the letters in the original phrase "play note middle C and play it softly" in which the letters are grouped into words, the digits 0 and 1 are grouped into arrangements that become meaningful MIDI messages to the MIDI or computer microprocessor. For example, the number series 10010000 00111100 00011000 in MIDI means "play note middle C and play it softly". Note how the 0's and 1's are grouped in a fashion similar to the letters in the original phrase.

Each of the 0's and 1's is a binary digit, or bit. These bits are grouped into eight-bit words, each of which we call a byte (also the name of the author's cat!). Bytes are used to specify numbers from 0 to 255. MIDI messages are written so that each of these 256 possible bytes means something specific.

Bytes are divided into two types. Those with values of 128 to 255 are status bytes. Status bytes specify what is to be done, and often on what channel it is to be done. A status byte is always the first byte in a MIDI message, and is identifiable because its first bit is always "1".

Those bytes with values of 0 to 127 are data bytes. Data bytes often come in pairs and specify additional information about what is to be done. Data bytes are always preceded by a status byte; they are identifiable because their first bit is always "0".

To ensure that the transmission of these bits and bytes seems instantaneous to a listener, MIDI sends messages one bit at a time at the rate of 31,250 bits per second. This type of transmission where the parts of a message are sent one at a time is called serial. Serial transmission is used for sending virtually all MIDI messages.

Status bytes and data bytes are structured to form messages that may range from one byte to thousands of bytes in length. Most MIDI messages, such as common performance commands, are made up of one status byte followed by one or two data bytes.

A simple note-on message, for example, would consist of one status byte followed by two data bytes. Such a MIDI command might specify that a note on MIDI channel 1 should be played (status byte), and that the note should be middle C (data byte 1), and that it should be played at maximum key velocity (data byte 2).

Because data bytes define which note is played, and the velocity at which it is played, there are 128 possible MIDI notes – more than a piano – and 127 possible key velocities (0 velocity is a special case).

Change each number in a MIDI command and a different musical result occurs. You could alter the previous MIDI command so that it specified that a note on MIDI channel 2 should be played (status byte), and that the note should be middle C-Sharp (data byte 1), and that it should be played at a low key velocity (data byte 2).

Using this technique it becomes easy to send Note On and Note Off messages, as well as messages about how pressure was applied to a key after it was played (called Aftertouch), messages about Pitch bend and more than a hundred other messages called Control change messages that permit the subtle shaping of music.