More about MIDI

This article covers the basics of MIDI.

What is MIDI

MIDI (Musical Instrument Digital Interface) is a way for musical instruments to communicate. Information sent using MIDI consists mostly of what to play and how to play it. MIDI is generally manufacturer and model independent, that is, different MIDI instruments will all respond to MIDI in the same way. It is important to remember that MIDI consists of instructions of what to play, not the sound itself.

The basic instructions sent using MIDI are often called MIDI events or MIDI messages. The following sections examine the most common types of events.

Notes

When you play a note on your MIDI keyboard, two MIDI events are sent: the Note On when you press the key and the Note Off when you release the key.

All note messages have two associated parameters: the note number and the velocity number. The note number is the key number of the key you pressed, for example, middle C is note number 60. Higher notes have higher numbers, so C# has note number 61.

When describing notes, it is common to give a note name followed by a number. The number is the octave of the note. For example, middle C is described as C4. The 4 refers to the fourth C on a conventional piano. Note that on many 61 note keyboards, Middle C may in fact only be the third C on the keyboard - 61 note keyboards generally start at note C2. Using this notation, octaves run from C to B; on a conventional 88 note piano, the lowest note is A0 and the highest note is C8.

The velocity gives the relative loudness of the note. The term "velocity" probably originates from the early days of touch sensitive keyboards when there were two electrical contacts on each key. The speed that these two contacts were made would determine how fast the key was moving and hence how loud the note should be.

Key numbers have a range from 0 to 127. Velocity has a range from 1 to 127.

There is a special case of a note message called a 0 velocity note. If a velocity of 0 is used on a Note On message, this really means a Note Off message. Some keyboards use this.

Program changes

Program change events are used to select the various sounds available on your MIDI instrument. Program change events take a single parameter: the number of the program to change to. Program numbers range from 0 to 127, but sometimes these are listed as being from 1 to 128 (just add one).

Many modern keyboards have more than 128 sounds. To overcome the limitation of only 128 imposed by the program change message, two controller messages can be used in conjunction with the program change to select different banks of sounds. These controller messages are called bank select messages.

The bank select messages form the more significant and less significant portions of a number. Each controller message has a range from 0 to 127. So, using both bank select messages and a program change message, it would be possible to select over 2 million (128 times 128 times 128) different sounds. Typically, instruments do not (yet) have this many sounds, so they only respond to particular bank numbers.

Controllers

Controller messages control the way notes should sound. There are lots of different controllers and they all have different functions, such as modulation, volume, stereo pan, sustain pedal and so on.

Each controller message has a controller number and a value. There are 128 different controllers (numbered 0 to 127) and each has a value between 0 to 127.

The controller number determines what the controller does. For example, controller 0 is bank select, controller 1 is modulation, controller 7 is volume and controller 10 is stereo pan.

Not all controller numbers have a defined meaning and each MIDI instrument will respond to a different set of controllers. Here are a few:

Controller 0 is the bank select controller. It is used in conjunction with controller 32 and the program change message to select different banks of sounds.

Controller 1 is modulation depth. Modulation is generally used for vibrato, but the effects can vary. This controller message is sent whenever you move the modulation wheel on your keyboard. The value for this controller goes from 0, no modulation, to 127, maximum modulation.

Controller 7 is volume. The controller has a range from 0 (silence) to 127 (maximum volume.

Controller 10 is stereo pan. The controller takes values between 0 and 127. Setting pan to 64 sets the pan position to centre. Values greater than this move the pan to the right and values less than this move the pan to the left.

Controller 11 is expression. This functions in exactly the same way as controller 7 (volume). If your instrument responds to both volume and expression controllers, then you can use the expression controller to add expression to notes. Use the volume controller to set the overall volume, a bit like the fader on a mixing console.

Controller 64 is used to simulate the sustain pedal. This controller only has two values: 0 for pedal off and 127 for pedal on.

Controller 91 is often used to control the amount of reverb. The controller takes values from 0 (no reverb) to 127 (maximum reverb).

Controller 93 is often used for chorus level. Again, this controller can take a value from 0 to 127.

Your MIDI instrument may respond to several other controllers not listed here. Consult the manual for your MIDI instrument for details.

Some controller messages, with numbers from 120 to 127, have special functions, such as to turn all notes off.

Registered and non-registered parameters

Just as the limitation of only 128 program numbers is overcome by using bank select messages, so also the limitation of only 128 different controllers is overcome by using registered parameters (RPN) and non-registered parameters (NRPN).

Both registered and non-registered parameters operate in the same way: First, you select which parameter you wish to set, by using the RPN select or NRPN select controllers (100 and 101, 98 and 99). Then, you use controller 6 (data entry) to set the value. You can optionally also use controller 38 in conjunction with controller 6 for data entry.

One typical registered parameter is parameter 0: pitch bend range. As an example, to set the pitch bend range to 12 semitones (one octave), set both controller 100 and controller 101 (the RPN select) to 0. Then set controller 6 (data entry) to 12.

Not all MIDI instruments respond to RPN and NRPN messages. Consult the manual for your instrument.

After using RPN or NRPN, set both the RPN or NRPN select parameters to 127. This is simply to stop further data entry controller messages having an effect.

Pitch bend

Pitch bend messages are sent whenever the position of the pitch bend lever changes. Although pitch bend can be thought of as another controller, it does in fact have its own class of MIDI event.

Pitch bend messages have a range from -8192 to +8191, with 0 meaning the pitch bend lever in the centre.

Precisely how much pitch variation occurs when you use pitch bend is determined by the pitch bend range setting. This may be adjustable using RPN messages, or may be controlled by settings on your instrument.

For example, if the pitch bend range was 2 semitones, to raise the pitch to 1 semitone above normal pitch, send a pitch bend message with a value of 4096 (half the maximum).

Aftertouch

On some keyboards, after you have pressed a key, you can press harder to add various effects. This extra pressure is called aftertouch.

In MIDI, there are two forms of aftertouch message: polyphonic aftertouch, where each key can respond individually to aftertouch and channel aftertouch, where all notes being played by that channel respond equally to the aftertouch.

Like controllers, aftertouch can take a value from 0 (none) to 127 (maximum).

Channels

All the MIDI messages discussed so far are known as channel messages. Each message has a channel, from 1 to 16. Each MIDI channel operates independently, meaning that you can control up to sixteen simultaneous instruments.

Each MIDI instrument in your MIDI setup should then be set to respond to those channels you want. Many instruments can be set to respond to a single MIDI channel only. If the instrument receives MIDI data on a channel other than the one selected, the instrument will not respond.

Alternatively, many instruments can be set to respond to all MIDI channels. This is sometimes called multitimbral mode. Then, it's like having sixteen synthesisers instead of just one. Each MIDI channel operates completely independently so you could have a piano on channel 1, bass on channel 2, strings on channel 3 and so on.

MIDI channel 10 is often used for percussive instruments, such as drums. All other channels are usually set for melodic instruments. Your MIDI instrument may be able to change this behaviour, but this is the normal setup.

System exclusive messages

All the MIDI messages considered so far have been ordinary channel messages. The messages are the same regardless of MIDI manufacturer and the model of MIDI instrument you have.

There is a class of message, however, which is specific to each MIDI instrument. These are called system exclusive messages.

System exclusive messages are different for each type of MIDI instrument and are generally not compatible across different MIDI devices.

Often, system exclusive messages are used for controlling the instrument in ways which cannot be done with conventional MIDI messages. This might include, for example, configuring the instrument's setup, setting effect parameters or designing a particular sound (patch) on a synthesiser.

The range of system exclusive messages that a MIDI instrument responds to is detailed in its manual. This can make daunting reading, especially if you are not familiar with hexadecimal or the fine details of the operation of your MIDI instrument. However, the results achievable with system exclusive messages may add a whole new dimension to your musical performances.

Other messages

The messages discussed in this article are probably the most common MIDI events. However, there are many more, such as those used for sequencing and synchronisation, as well as various miscellaneous events not covered in this article.

We have also not discussed exactly what numbers pass through the MIDI wires. For further information, there are many excellent resources available on the net.

 

Return to QWS articles