MIDI is a communications protocol established in 1984, in order to allow one keyboard to serve the master keyboard for controlling various synthesizers in a performance, saving the performers from jumping around different synthesizers to create different sounds. MIDI captures performance gestures such as the note, the volume of the note (expressed by the velocity of the hammer hitting the piano string), the channel in which the note is played, whether foot pedal is used on the note, possible modulations of the note and the timbre of the sounds.
MIDI is an 8-bit system that has two types of data: Status Byte and Data Byte. Status Byte’s MSB is a 1, while Data Byte’s MSB is a 0. The highest and lowest possible status byte is 255 and 128 respectively, while the highest and lowest possible data byte is 127 and 0 respectively.
In a complete Note On message, the status byte, between 144 and 159, represents ‘note-on, on channel 1 to 16’, and 2 data bytes representing the note and velocity of the note, each of which ranges from 0 to 127.
Controller message represents the control aspects of the sounds decided by a performer’s use of foot pedal, modulation wheel or any other sliders that affect the sounds. In a complete Controller message, the status byte represents, between 176 and 191, means ‘controller message, on channels 1 to 16’, and 2 data bytes representing the type of controller moved and the extent and how far was it moved, each of which ranges from 0 to 127.
There is only one data byte to represent the type of patch used as a timbre is absolute and cannot be variated further.
MIDI notes can be turned off when data byte for velocity of the note is set to 0, even though there is a MIDI note off message as it is more efficient to use the former method.
MIDI can send multiple messages of Note on and Controller message to 16 different channels at the same time. For example, Note On Status Byte ranges from 144 to 159, in which 144 means ‘note on, channel one’, 159 means ‘note on, channel 16’; Controller message ranges from 176 to 191, in which 180 means ‘controller message, channel five’.
MIDI timing is executed against a time stamp from time zero and encoded in a MIDI file. For example, a MIDI file starts with a note-on message, followed by a note-off message 1000 milliseconds later: 0 144 60 96 (time 0, note on, channel 1, note C, velocity 96) / 1000 144 60 96 (time 1000, note on, channel 1, note C, velocity 0). A MIDI file can also have controller message that looks like this: 0 176 1 1 (time 0, controller message, channel 1, modulation, value 1) / 20 176 1 15 (time 20, controller message, channel 1, value 150), meaning that in 20 milliseconds, the modulation wheel has moved to a value of 15.
Construct a MIDI note-on message that lasts for 1000 milliseconds by sending, for example, note 35 and velocity 100, to ‘makenote’ object. These are sent out to ‘noteout’ object on channel 10 (which is preserved for percussion instruments) to device number 1, which is the computers’ internal synth. A bass drum sound then can be heard from the computer’s speaker. We can choose other note value from 35 to 81 to trigger different drum sounds, such as hi-hats and snare drums. Velocities represent how hard the drum pad is pressed and thus determines the loudness of the sound.