MIDI (Musical Instrument Digital Interface): A Technical Overview

A technical overview of the MIDI protocol.

• 3 min read
by Damjan Prvulović

Unlike humans, a computer needs a (digital) format of representation to interpret or “understand” the music. This article describes the most important specifications of the MIDI (Musical Instrument Digital Interface) protocol.

The MIDI (Musical Instrument Digital Interface) protocol was created in the 1980s to enable electronic instruments, music software, and other digital musical devices to communicate with each other. MIDI does not contain information about the actual sound of the notes being played, MIDI carries only note performance data and control data, like “note on”, “note off”, “note/pitch”, “modulation”, etc. [1]

“Note on”, and “Note off” MIDI messages in more detail [2, p. 29]:

  • “Note on” messages indicate that a note starts being played and consists of the following information:
    • channel number, for specifying the instrument or track (as an integer value between 0 and 15)
    • MIDI note number, identifying which note is exactly played (as an integer value between 0 and 127. Each step corresponds to a semitone) - e.g., 60 being the middle C (C4), 61 the C# (C#4), 62 the D (D4), and so on.
    • velocity, specifying how loud the note is played (as an integer value between 0 and 127). Different velocities may also produce different timbres in an instrument. Thus not exclusively linked to loudness.
  • “Note off” messages indicate that a note ends.

As an example: “Note on, 0, 60, 100”, indicates that on track 0, the middle C (60) with velocity 100 starts being played. “Note off, 0, 60, 20”, indicates that the middle C (60) with velocity 20 stops being played. Note off velocities express how fast the note is being released.

To represent the dimension time, MIDI adds to each note event a time code (a delta-time value), which indicates when the event happened in relation to a pre-defined value (named division). The division defines the number of ticks per quarter note.

Along with the protocol a MIDI file format is also defined. Setting the division to 384 ticks per quarter note (corresponds to 1536 ticks for a whole note, 768 for a half note, or 96 ticks for a sixteenth note), an excerpt from a MIDI file (in ASCII-Code) could look as follows:

Excerpt from a MIDI file (in ASCII-Code)
Figure 1: Excerpt from a MIDI file (in ASCII-Code).
Score corresponding to the MIDI excerpt from Figure 1
Figure 2: Score corresponding to the MIDI excerpt from Figure 1.

References

[1] MIDI Manufacturers Association (MMA). Accessed: 16.05.2021. [Online]. Available: https://www.midi.org/specifications

[2] J.-P. Briot, G. Hadjeres, and F.-D. Pachet, Deep Learning Techniques for Music Generation. Cham: Springer International Publishing, 2020. [Online]. Available: https://doi.org/10.1007/978-3-319-70163-9