Chapter Three: MIDI
1. How does the MIDI system work? Page 4
Channel Voice Messages
Almost all MIDI devices are equipped to receive MIDI messages on one or more of 16 selectable MIDI channel numbers. A device's particular voice (or patch, program, timbre) will respond to messages sent on the channel it is tuned to and ignore all other channel messages, analogous to a television set receiving only the station it is tuned to and rejecting the others. The exception to this is OMNI mode. An instrument set to receive in OMNI mode will accept and respond to all channel messages, regardless of the channel number.
The most common MIDI messages are channel voice messages listed in the chart below. They convey information about whether to turn a note on or off, what patch to change to, how much key pressure to exert (called aftertouch), etc.
The table below presents a summary of the MIDI Channel Voice Message codes in binary form.
A MIDI channel voice message consists of a status Byte followed by one or two data Bytes.
Click here for a list of currently assigned MIDI controller numbers.
|Status Byte||Data Byte 1||Data Byte 2||Message||Legend|
|1000nnnn||0kkkkkkk||0vvvvvvv||Note Off||n=channel* k=key # 0-127(60=middle C) v=velocity (0-127)|
|1001nnnn||0kkkkkkk||0vvvvvvv||Note On||n=channel k=key # 0-127(60=middle C) v=velocity (0-127)|
|1010nnnn||0kkkkkkk||0ppppppp||Poly Key Pressure||n=channel k=key # 0-127(60=middle C) p=pressure (0-127)|
|1011nnnn||0ccccccc||0vvvvvvv||Controller Change||n=channel c=controller v=controller value(0-127)|
|1100nnnn||0ppppppp||[none]||Program Change||n=channel p=preset number (0-127)|
|1101nnnn||0ppppppp||[none]||Channel Pressure||n=channel p=pressure (0-127)|
|1110nnnn||0fffffff||0ccccccc||Pitch Bend||n=channel c=coarse f=fine (c+f = 14-bit resolution)|
A sample message for turning on a note (middle C) on MIDI channel #5 very loudly (with a velocity or force of 127, the maximum) is shown below in binary.
|status byte||data byte||data byte|
The first four bits of the status byte (1001) tell MIDI that the following message is a note-on command, while the last four bits tell MIDI what MIDI channel the message is for (0000=MIDI channel #1, 1111=MIDI channel #16). Note that the channel number are offset by one value, since channel 1 is set by binary '0' and channel 16 is set by binary '15.' The first data byte tells MIDI what note to play (decimal 60=middle C), while the second data byte tells MIDI how loud to play the note. In this case the maximum velocity of 127 is sent. The note will sound until a message to turn off the same note number is received.
Simultaneous events in MIDI must be sent as a string of serial commands. A 3-note chord, for example, will be transmitted as three separate note #-velocity pairs. Because of the 31.25 Kbaud transmission speed, this is normally perceived as a simultaneity. However, as polyphonic instruments (those capable of playing more than one note simultaneously) have increased their number of voices and more MIDI set-ups have networks of ever-increasing numbers of instruments and tone modules, the speed of both the interface's processor and sheer volume of serial data make large simultaneous events susceptible to glitches, undesired arpeggiations, and data errors.
To make more efficient use of the limited bandwidth, MIDI manufacturers adopted a shortcut called running status. Running status allows a single status byte's action to remain in effect for an unlimited number of data byte pairs which follow. For example, to play three 'simultaneous' notes on the same MIDI channel, a Note On status byte can be sent, followed by six data bytes.
status(note on, ch 1) key1-velocity key2-velocity key3-velocity
To help minimize excessive data by using running status, the note on command can also function to turn notes off by sending a velocity value of zero for the key # to be turned off. so:
status(note on, ch 1) key1-velocity1 key2-velocity2 key3-velocity3 key1-velocity0 key2-velocity0 key3-velocity0
Many instruments transmit and respond to key velocity, the speed at which a key is depressed. Some even respond to the speed at which a key is released. Most simply allow dynamic range to be controlled, while others have the capability to alter timbre or spatial location through velocity. Recent instruments often have the capacity to crossfade or switch between two different sounds, based upon the speed of a keystroke.
While almost all channel voice messages assign a single data byte to a single parameter such as key # or velocity (128 values because they start with '0,' so = 2^7=128), the exception is pitch bend. If pitch bend used only 128 values, discreet steps might be heard if the bend range were large (this range is set on the instrument, not by MIDI). So the 7 non-zero bits of the first data byte (called the most significant byte or MSB) are combined with the 7 non-zero bits from the second data byte (called the least significant byte or LSB) to create a 14-bit data value, giving pitch bend data a range of 16,384 values.