Go to Home Page Go Back to previous page Go to bottom of page Go Forwards to next page
Go to Home Page Go Back to previous page Go to top of page Go Forwards to next page

MIDI is an acronym for Musical Instrument Digital Interface. Or, to put that into words, it is a way of representing music electronically, or from a computers point of view. You may find it useful to read the section on Computers, for a primer on binary number theory.

MIDI is constructed from ‘Events’. There are ‘Note’ events, ‘Controller’ events, ‘Program’ or instrument change events, to name three. Each event is coded as a sequence of bytes. The number of bytes depends on the type of event. The first byte is called the ‘Status’ byte. This informs the MIDI receiver what type of event is being transmitted. This is followed by a number of bytes carrying the MIDI event ‘Data’, which is the information that the MIDI event contains. The tables show how MIDI bytes are encoded:

The top bit (7) determines what the rest of the byte contains. If it is ‘1’ the lower 7 bits indicate status and if ‘0’, the 7 bits are data (Data Bit 0 to 6), with a value from 0 to 127 (2^7[Bits]=128). The status byte is a command that informs the MIDI receiver the function of the following data bytes. Bits 0 to 3 indicate the MIDI ‘Channel’ that the event is transmitted on, four bits=2^4=16 channels. The three bits from bit 4 to bit 6 indicate the type of event being transmitted. There are eight (2^3[Bits]=8) types of event, as shown in the following status byte diagram:

The data byte is a number, representing a value in a MIDI event. For example, when a key on a MIDI keyboard is pressed, a ‘Note On’ message is sent, which contains two data bytes, the Note Number and the Velocity. The Note Number indicates the pitch of the key and is a value from 0 to 127, arranged chromatically from ‘C0’ (C-Zero) to ‘G10’. Each note is one semitone. The note is usually indicated with an octave number. For example, Middle-C is note number 60. As there are twelve semitones to an octave, this means that note 60 is C5 (octave=60/12=5).

The Velocity is also a number from 0 to 127 and represents the intensity of the key press. A velocity of 127 is the heaviest and 1 is the lightest. Velocity 0 is a special case, meaning ‘Note Off’.

There is also a separate ‘Note Off’ MIDI event, which can be transmitted. So which one do we use when playing music? Well, either will work, but using Note On with Velocity=0 allows us to ‘compress’ the MIDI transmission, by using a technique called ‘Running Status’. When the music starts playing, a complete three byte note message is sent to inform the MIDI receiver what is to follow. But if all the following events are also notes, it is not necessary to send the status byte again, until another type of MIDI event, or a channel change was required (the channel is sent in the status byte). This is because the status would be the same for every note message and therefore only needs to be sent once. All that is required is that Note On messages are used exclusively , with a velocity of 1 to 127 indicating Note On and a velocity of 0 indicating Note Off.


Q:
You said that MIDI was constructed from eight bit bytes. On a MIDI keyboard, there are only five pins on the MIDI Out connector. How are all those bits transmitted?

A: Good question, read on..

When MIDI is stored on a disk, it is saved in ‘Standard MIDI File’ format or SMF, which is essentially a sequence of bytes, as discussed above. There are also additional bytes saved in the file for timing and other special MIDI information, for example, time signature (‘meter’) or lyrics.

When MIDI is transmitted electronically, through a cable, it is also sent as a sequence of bytes, but with a difference. The bytes are sent serially, one bit at a time.

...
To Be Continued!

Status Byte Event Type
1000cccc 8xh Note OFF
1001cccc 9xh Note ON
1010cccc Axh Polyphonic Aftertouch
1011cccc Bxh Controller
1100cccc Cxh Program/Instrument Change
1101cccc Dxh Channel Aftertouch
1110cccc Exh Pitch Bend
1111cccc Fxh System Messages

The byte is shown in Binary and Hexadecimal.
The MIDI Channel is shown as ‘cccc’ in the binary and ‘x’ in the hexadecimal.

The three event bits (4 to 6) are shown highlighted in the binary.

If bit 7='0' then the byte is Data:
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 Data Bit 6 Data Bit 5 Data Bit 4 Data Bit 3 Data Bit 2 Data Bit 1 Data Bit 0

If bit 7='1' then the byte is Status:
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
1 Event Bit 2 Event Bit 1 Event Bit 0 Channel Bit 3 Channel Bit 2 Channel Bit 1 Channel Bit 0

Back Up Forward

What is MIDI ?