Note Names

Before discussing MIDI note numbers, it is important to understand some basic principles about how musicians name musical notes.

Many instruments can play distinct pitches (ie, a musical scale). For example, an acoustic piano has 88 keys, or 88 distinct pitches/notes.

Instruments with keyboards (such as the pipe organ and harpsichord) were among the earliest, most versatile musical instruments at around the time when musicians were devising a way to notate music. So, it's traditional to name musical pitches based upon the piano keyboard. A piano has white and black keys. They are visually grouped into octaves where one octave contains 12 keys. (ie, One octave contains 7 white keys which are interspersed by 2 groups of black keys). Below is a picture of one octave of keys upon a piano.

Musicians name the musical pitches played upon the white keys by using the alphabetical names A to G. For example, "middle C" is the white key closest to the center of the keyboard. Musicians append sharps or flats to the alphabetical names to identify the black keys. For example, the black key above middle C is a C#. Also, musicians use the octave number to further identify a particular key. For example, "middle C" is specifically the C in the fourth octave upon a piano (so it would be notated as C4. I refer to that as its note name).

Below is a portion of a piano with the keys labeled as a musician would refer to them. (ie, Here are the note names for 3 octaves of keys, starting at octave 1).

C#1
D#1 F#1 G#1 A#1 C#2 D#2 F#2 G#2 A#2 C#3 D#3 F#3 G#3 A#3
C1 D1 E1 F1 G1 A1 B1 C2 D2 E2 F2 G2 A2 B2 C3 D3 E3 F3 G3 A3 B3


MIDI Note Numbers

A MIDI controller (be it a piano-like keyboard, a MIDI guitar, a MIDI drum kit, etc) can have upto 128 distinct pitches/notes. (Consequently, A MIDI controller has a wider range of notes -- ie, more octaves of notes -- than even an acoustic piano). The lowest note is a C upon a MIDI controller (as opposed to an A upon an acoustic piano).

But whereas musicians name the keys using the alphabetical names, with sharps and flats, and also octave numbers (as shown in the diagram above), this is more difficult for MIDI devices to process, so they instead assign a unique number to each key. The numbers used are 0 to 127. As mentioned, the lowest note upon a MIDI controller is a C and this is assigned note number 0. The C# above it would have a note number of 1. The D note above that would have a note number of 2. Etc. "Middle C" is note number 60. (ie, There are 59 other keys below middle C upon a MIDI controller). So, a MIDI note number of 69 is used for A440 tuning. (ie, That is the A note above middle C).

Below is a portion of a piano with the keys labeled as a MIDI Device would refer to them. (ie, Here are the note numbers for 3 octaves of keys, starting at the lowest octave).

1
3 6 8 10 13 15 18 20 22 25 27 30 32 34
0 2 4 5 7 9 11 12 14 16 17 19 21 23 24 26 28 29 31 33 35

For a more indepth discussion of why machines use MIDI note numbers, see Why humans and machines refer to musical pitches in different ways.

As mentioned, a MIDI controller can theoretically have 128 keys (or frets, or drum pads, etc). Of course, in practice, it's too expensive to manufacture a MIDI controller with 128 keys on it. Besides, most musicians aren't accustomed to playing a keyboard with more than 88 keys (or a drum kit with 128 pads, etc). It would seem very odd to the musician -- perhaps even too unwieldly an instrument to play. So typically, most controllers have less than 128 keys upon them. For example, a "full-size" keyboard controller will usually have only the 88 keys that a piano has; the lowest key being the low A like upon a piano. (ie, Its lowest key is actually MIDI Note Number 21). Nevermind that a true "full-size" keyboard controller would have 128 keys and its lowest key would go down to a C two octaves below the piano's A key. Of course, most keyboard controllers have a "MIDI transpose" function so that, even if you don't have the full 128 keys, you can alter the note range that your (more limited) keyboard covers. For example, instead of that lowest A key being assigned to note number 21, you could transpose it down an octave so that it is assigned a note number of 9.


Errata

Some MIDI software or devices don't use MIDI note numbers to identify notes to a musician (even though that's what the MIDI devices themselves expect, and what they pass to each other in MIDI messages). MIDI note numbers don't mean that much to a musician. Instead, the software/device may display note names, such as F#3 (ie, the F# in the third octave of a piano keyboard).

There is one, nagging discrepancy that has crept up between various models of MIDI devices and software programs, and that concerns the octave numbers for note names. If your MIDI software/device considers octave 0 as being the lowest octave of the MIDI note range (which it ideally should), then middle C's note name is C5. The lowest note name is then C0 (note number 0), and the highest possible note name is G10 (note number 127).

Some software/devices instead consider the third octave of the MIDI note range (ie, 2 octaves below middle C) as octave 0. (They do this because they may be designed to better conform to a keyboard controller that has a more limited range; one which perhaps doesn't have the two lowest octaves of keys which a 128 key controller would theoretically have. So they pretend that the third octave is octave 0, because the first two octaves are physically "missing" on the keyboard). In that case, the first 2 octaves (that are physically missing) are referred to as -2 and -1. So, middle C's note name is C3, the lowest note name is C-2, and the highest note name is G8. This discrepancy is purely in the way that the software/device displays the note name to you.