A Note On message is transmitted when a key is pressed on a keyboard, and a Note Off is transmitted when it is released.
When a device receives a Note On message, it looks for two data bytes: "which note" and "how loud" it should play it.
The note will continue to play until the Note Off message is received, and it too must contain note and velocity numbers because the device might be playing several notes when the Note Off is received.
The Note On / Note Off combination is the most common pair of messages in any MIDI transmission.
When a device is turned on, it will load one of its sounds into its RAM and prepare itself to receive note messages.
These sounds are permanently stored in the device, and the device operating system tells how to create the required sound.
When the device is ask to load a new sound, it must change the program it is currently running to play notes using the new tone.
Hence, the MIDI message that tells the device what sound to make is called a Program Change message.
Program Changes are followed by a single data byte (the Program Number or the "Patch").
Note, that MIDI devices use two different numbering schemes for programs, 0-127 or 1-128. It is important to know which scheme your devices use.
Therefore it was unlikely that music created for one synthesizer would sound correct when performed by another.
When using General MIDI, files will sound identical (or nearly so) when played by different instruments.
More about General MIDI Voice List
In addition to a standardized assignment of program change numbers, General MIDI also defines that Channel 10 are reserved for drum sounds.
It also provides a Drum Map, which is the fixed assignment of certain drums sounds too specific MIDI note numbers.
More about General MIDI Percussion Key Map
Control Change messages are used to changes in the status of a physical control, e.g. foot pedals, volume sliders, modulation wheels, and similar peripherals.
Controllers are numbered from 0 to 127. These numbers are standardized, for example, controller 10 is used for panning between left and right speakers, while controller 7 is used for volume changes.
More about MIDI - Controller List
Some control messages act like simple on and off switches.
For example, the sustain pedal can only be down or up, so a single status byte can be used to specify which state the pedal is in, and no data bytes are required.
Other controls are continuously changing and are represented by more detailed data.
For example, if you move the pitch wheel from its resting position to one extreme, MIDI transmits data representing the wheel's position at numerous points.
In this case, the data must be very high in resolution; 2-byte messages are used. This provides a total of 16,384 values.
System messages are transmitting information without a channel assignment.
As a result, all instruments that receive system messages would act upon them, though one particular type of system message, called system exclusive, is intended for communicating only with a device or devices made by a specific manufacturer.
As all major instrument makers have an ID number (e.g. #67 for Yamaha), a message can be "addressed" to one device and all other receiving instruments will ignore it.
For example, all the instructions specifying how a synthesizer makes it sounds could be "dumped" from the device and stored on a computer.
This means that a whole new setup of sounds could be sent just before actual note data was transmitted, thereby getting the instrument properly configured.
Other system messages include timing messages, which gives tempo information; and Song Position messages, which indicate where a recorded MIDI sequence should begin playback.
More about MIDI - Message List.