MIDI (Musical Instrument Digital Interface) is a protocol developed in the 1980's which allows electronic instruments and other digital musical tools to communicate with each other.  MIDI itself does not make sound, it is just a series of messages like "note on," "note off," "note/pitch," "pitchbend," and many more.  These messages are interpreted by a MIDI instrument to produce sound.  A MIDI instrument can be a piece of hardware (electronic keyboard, synthesizer) or part of a software environment (ableton, garageband, digital performer, logic...).

The advantages of MIDI include:
compact -an entire song can be stored within a few hundred MIDI messages (compared to audio data which is sampled thousands of times a second)
easy to modify/manipulate notes -change pitch, duration, and other parameters without having to rerecord
change instruments -remember, MIDI only describes which notes to play, you can send these notes to any instrument to change the overall sound of the composition.

Step 1: Note on, note off, and velocity

The most common tool used to generate MIDI messages is an electronic keyboard. These messages may be routed to a digital synthesizer inside the keyboard, or they may be patched to some other MIDI instrument, like your computer.

When a key is pressed the keyboard creates a "note on" message.  This message consists of two pieces of information: which key was pressed (called "note") and how fast it was pressed (called "velocity"). 

"Note" describes the pitch of the pressed key with a value between 0 and 127.  I've copied the table in fig 2 from NYU's website, it lists all the MIDI notes and their standard musical notation equivalents.  You can see that MIDI note 60 is middle C (C4).

"Velocity" is a number between 0 and 127 that is usually used to describe the volume (gain) of a MIDI note (higher velocity = louder).  Sometimes different velocities also create different timbres in an instrument; for example, a MIDI flute may sound more frictional at a higher velocity (as if someone was blowing into it strongly), and more sinusoidal/cleaner sounding at lower velocities.  Higher velocity may also shorten the attack of a MIDI instrument.  Attack is a measurement of how long it takes for a sound to go from zero to maximum loudness.  For example, a violin playing quick, staccato notes has a must faster attack than longer, sustained notes.
something to remember- not all keyboards are velocity sensitive, if you hear no difference in the sound produced by a keyboard no matter how hard you hit the keys, then you are not sending variable velocity information from that instrument.  Computer keyboards are not velocity sensitive, if you are using your computer's keys to play notes into a software sequencer, all the notes will have the same velocity.

When a key is released the keyboard creates another MIDI message, a "note off" message.  These messages also contain "note" information to ensure that it is signalling the end of the right MIDI note.  This way if you are pressing two keys at once and release once of them, the note off message will not signal the end of both notes, only the one you've released.  Sometimes note off messages will also contain velocity information based on how quickly you've released the key.  This may tell a MIDI instrument something about how quickly it should dampen the note.

Figure 1 shows how these MIDI messages are typically represented in MIDI sequencing software environments (in this case GarageBand).  Each of the notes in the sequence are started by a note on message and ended with a note off message. In GarageBand the velocity attached to the note on message is represented by the color of the note.  In this image above the high velocity notes are white and the lower velocity notes are grey.

Figs 3 and 4 show MIDI notes recorded in Ableton.  Again you can see that the velocity associated with the note on message is represented by the color of the MIDI note- more saturated = higher velocity.  Also notice that the velocity is indicated by a line with a circle on top on the bottom of the screen.  By selecting one of your MIDI notes you can see the velocity associated with it; in fig 4 the D4 note has a velocity of 57.

About This Instructable


211 favorites


Bio: I'm a grad student at the Center for Bits and Atoms at MIT Media Lab. Before that I worked at Instructables, writing code for ... More »
More by amandaghassaei: OTCA Metapixel - Conway's Game of Life "9 Degrees of Freedom" IMU Twitter Controlled Pet Feeder
Add instructable to: