More about MIDI

Introduction

A MIDI message consists of a status byte and a number of data bytes.
Each byte has a start bit, 8 bits and a stop bit. With 8 bits any number from 0 to 255 can be formed. The highest value bit is called the Most Significant Bit and the lowest value bit is the Least Significant Bit. Each 8-bit byte can be divided into two 4-bit nibbles. These are sometimes referred to as the most significant nibble and the least significant nibble.

Controllers

The word "controller" may be used in connection with MIDI instruments in two ways..

Modern digital musical instruments would need a multitude of single purpose knobs and switches to make all the possible adjustments or selections. Instead a smaller number of multi-purpose buttons are usually provided with a liquid crystal display (L.Q.D.) to show which function has been selected. The MIDI instrument is normally played via its own keyboard (or whatever). If this local control is switched off then the instrument can only be played via its MIDI input. The control messages which can be sent out from the master instrument are of two types, switch controllers and variable controllers. Switch controllers simply turn a facility (eg. modulation) on or off . Variable controllers are MIDI messages which can change the parameters of a particular facility (eg. change the shape of an envelope ).
From the musician's point of view, the important control messages are the channel voice messages. These control the voices of an instrument.

Channel voice messages

Channel voice messages control the voices of a MIDI instrument by switching notes on/off, changing the "loudness" and varying the pitch etc.

Note on

The note on channel voice message consists of 3 bytes. The first byte contains the channel number and the note on code. The second byte gives the note value (ie. pitch). The range of values is from 0 to 127. Each increment raises the pitch by one semitone.
The 128 note values (0 to 127) therefore give a pitch range of 10.5 octaves.
The third byte of the note on message gives the keyboard velocity.
On a conventional piano the harder you hit a key, the faster the key moves and the harder the hammer strikes the string. Hence the louder the note sounds. Keyboard velocity depends on the time taken for a piano key to move from the up position to the down position where it strikes the string. On a MIDI keyboard therefore, the digital code which determines how loudly a note is sounded is called keyboard velocity.

Some instruments do not have velocity sensitive keys. Nevertheless a velocity value must always be transmitted; it will be expected by the receiving instrument. In this situation a middle value of 64 is transmitted.

So, a note-on message consists of 3 bytes...

        1. Channel number + status (eg. "Ch.3" + "note-on")
        2. note value (pitch)
        3. keyboard velocity value (loudness).

Note Off

Once a note has been switched on it will sound until it is switched off again. It is possible to switch a note off by setting the "note on" keyboard velocity value to zero. Some manufacturers use this method. However the standard method is to use a separate channel voice message, the "note off" message.

Again this consists of 3 bytes..

         1. Channel number + status (eg. Ch.3 + "note off")
         2. Note value (pitch)
         3. Velocity value (zero).

MIDI can send information about several notes on each channel and may send on several channels simultaneously. Therefore the note off message must contain the channel number and note value so as to make it clear which note is to be turned off.

Program Change

The controls of a synthesizer can be preset to give a particular sound. When the controls are altered to a different series of settings a different sound is obtained. Each preset selection is called a program.

A program change message permits the preset sounds (programs) of an instrument to be changed at any time. All the instrument voices may use one program or a different program may be assigned to each voice.

The program change message is a 2 byte message..

        1. Channel number + status (eg. Ch.3 + "message change")
        2. Program number.
With 7 bits, only 128 program numbers (0 - 127) are available, so it is not practical to standardize MIDI program sounds. Program number 13 (for example) cannot be reserved to produce a flute sound from all MIDI synthesizers.

Pitch bend

The pitch of a note can be altered by small amounts ie. much less than the semitone increments set by the "note on" channel voice message. This is called pitch bending.

Pitch bend is a 3 byte command..

          1. Channel number + status (eg. Ch.3 + "pitch bend")
          2 + 3. Data bytes producing a (7 + 7 =)14 bit number.

The range of numbers available with 14 bits is 0 to 16,384. This range of numbers permits extremely fine pitch control. Unfortunately such fine control (high resolution) requires a large number of messages to be transmitted in a short period. Some manufacturers prefer to use a dummy (zero) byte for one of the 3 bytes in the pitch bend message. This provides an adequately smooth pitch variation without the problem of transmitting large amounts of data at high speed.

Return to top of this page

Control change messages or "Controller messages"

Another category of MIDI message, the controller message, alters note parameters (eg. envelope amount).
The controller message is also 3 byte.
           1. Channel number + status (eg. Ch.2 + "control change")
           2. Control number (the number of the control to be changed)
           3. Value(the new value to set the control to).
Some controls merely need to be switched on and off but others are variable. A range of 0 to 127 may not be adequate for some variable controls so control messages may be paired to give 14-bit resolution.

As with pitch bend there is a problem with transmitting all this data at a fast enough rate. In practice therefore most equipment uses 7-bit resolution for variable controller messages.

Most of the available MIDI control change numbers are unassigned. The control numbers which are assigned by convention are given in the Table, below .

These few conventionally assigned controllers are sufficient to give basic compatibility between MIDI instruments.

Control change numbers and their functions
VARIABLE CONTROLS (0 - 63)
Modulation wheel 1
Breath controller 2
Foot pedal 4
Portamento time 5
Data entry 6
Main volume control 7
 
SWITCH CONTROLS (64 - 95)
Sustain pedal 64
Portamento 65
Sostenuto 66
Soft pedal 67
 
UNASSIGNED CONTROLS (96 - 120)
 
CHANNEL MODE MESSAGES (121 - 127)
Reset all controls 121
Local control 122
All notes off 123
Omni mode off 124
Mono mode on 126
Poly mode on 127

The unassigned controllers enable equipment such as automated audio mixers to be set by MIDI control change messages.

Changing channel modes with control-change messages

You will notice from the table that MIDI control numbers 121 to 127 are reserved for switching MIDI modes (see below) via an interface.
Take mode 4 (omni off/mono) as an example of how to select a MIDI mode using control change messages..

  1. a message to controller 124 switches OMNI mode OFF
  2. a message to controller 126 switches MONO mode ON


Return to top of this page

MIDI channels and MIDI modes

MIDI messages

MIDI information is transmitted and received one bit at a time. A small current (5mA) is switched on and off rapidly. Current on represents Logic 0, current off represents Logic 1. Each 0 or 1 in a MIDI message is called a bit. In computer jargon, a group of 8 bits is called a byte. Each MIDI message consists of a number of bytes, typically 1, 2 or 3 bytes. Each byte is preceded with a start bit and succeeded by a stop bit. The first byte in a MIDI message is sometimes called the header byte.

MIDI Channels

MIDI has 16 channels, numbered 1 to 16. Channels allow MIDI messages to be directed (channelled) to a particular device. This is made possible by placing a channel number in the header byte of a MIDI message. Channel numbers allow messages to be directed to a particular instrument in a multi-instrument setup. Channel numbers also allow messages to be directed to a particular device within an instrument eg. to a particular voice.

System messages

System messages do not have a channel number. These messages are responded to by all instruments in the setup that recognize the message.

Operating modes

Operating modes govern how a device deals with MIDI channels.