
The MIDI (Musical Instrument Digital Interface) standard defines a communications protocol between electronic musical devices. Any equipment conforming to the MIDI standard can be operated with any other MIDI device regardless of their manufacturer and type.
There are many aspects to MIDI, but essentially it is concerned with transferring information about which notes are being played from a control device (such as a keyboard, sequencer or computer) to a sound generator (such as a synthesiser, organ, piano or any other musical instrument capable of being operated by electrical signals).
The hardware part of the MIDI standard says that the communications will be in serial format with 1 start bit, 8 data bits, no parity and one stop bit at a rate of 31,250 bits per second.
Using this hardware definition, groups of 8 data bits (bytes) can be sent from one MIDI device to another. A further part of the MIDI standard defines how these bytes relate to what notes are being played.
In a practical system, it's quite likely that you might have several different sound generators, say one for a melody line, one for the accompaniament and one for the bass, all being driven by one controller. In such a setup there would have to be some way for the controller to send the right musical part to the right sound generator without all the signals getting mixed up. MIDI achieves this by allowing up to 16 different channels to be allocated. Each sound generator would be set to a different channel, so the controller can address each one by its channel number.
To turn a note on, the control device sends a group of bytes in turn which, between them, say that a note is to be turned on, which MIDI channel is being addressed, which note is to be played and what the velocity is (how hard the key on the control keyboard was hit).
To turn a note off again, when the controller key is released, another message is sent, similar to the one which turned the note on, but this time saying that the note is to be turned off. As before, the message has to say what the note is and on which channel it is.
The definition of which note is being turned on or off is done by a single number within the MIDI message, which can have any value in the range 0 to 127 inclusive. Each number represents one note in a chromatic musical scale, spanning a range of over 10 octaves, which is enough for most purposes. Higher MIDI note numbers represent higher pitched notes and vice versa, the difference in pitch between two adjacent note numbers being a semitone.
Middle C corresponds to MIDI note number 60, the C# above this has note number 61, the B below this is number 59 etc. Concert pitch A (440 Hertz) has note number 69.
J D Wale, February 1997.