Skip to content
12notez

MIDI Explained: Notes, Channels and Files

What a MIDI message carries, how note numbers map to pitch, what the 16 channels are for and what a .mid file from our converter contains.

·By Sudeep Jain

MIDI is a set of instructions that says which note to play, how hard and when. It carries no sound at all, so the same instructions can drive a piano, a bass or a string patch. The audio to MIDI converter writes those instructions from a recording, and this guide explains what is inside the file it saves.

What is MIDI, and what is it not?

MIDI stands for Musical Instrument Digital Interface. It was set up so that instruments, computers, mixers and other devices can exchange information such as notes, program changes and expression control. A MIDI file is not an audio recording. It is a list of events, so it is far smaller than the same music as audio.

What it lacks is any sound. The tone comes from whatever receives the messages. A MIDI keyboard sends notes and makes no sound by itself. A synthesizer turns notes into sound, and a software instrument does the same. MIDI keyboard specs explained covers what a controller can send.

What does a note-on carry?

A note-on message holds three things: the channel, a note number from 0 to 127 and a velocity from 0 to 127. Velocity says how forcefully the key was struck. A note-off message ends the note and has the same layout. A note carries pitch and force, and the receiving instrument decides what that sounds like.

How does a note number become a pitch?

The 128 numbers run from 0 (C-1) to 127 (G9). Middle C is 60 and A4 is 69. Each step up is one semitone. The General MIDI standard fixes note 69 as A at 440 Hz, which in turn makes 60 middle C. The converter shows note 60 as C4.

To get the frequency, multiply 440 by 2 raised to the power of the note number minus 69, divided by 12.

  • Note 64. 64 minus 69 is -5, so the power is -5/12, or about -0.4167. Two to that power is 0.7492, and 440 times 0.7492 is 329.63 Hz. That is E4.
  • Note 127. 127 minus 69 is 58, so the power is 58/12, or about 4.8333. Two to that power is 28.51, and 440 times 28.51 is 12,543.85 Hz. That is G9.

Going the other way, the note number is 69 plus 12 times the base-2 logarithm of the frequency divided by 440. Doubling the frequency adds 12, which is one octave.

The file stores only the number, never the hertz. The tuning is up to the instrument. If it tunes A4 to something other than 440, note 69 will sound at that pitch. The guide to A4 = 440 Hz and note frequencies covers other reference pitches, and Note mode in the Tone Generator plays any of these notes so you can hear them.

What are the 16 channels for?

A MIDI connection carries sixteen independent channels, numbered 1 to 16. Every channel message names its channel, and a device can listen to some channels and ignore the rest. In practice a channel is a part: one instrument on one channel, another on the next. A sequencer can send all sixteen down one cable and each instrument picks its own.

The General MIDI standard puts percussion on channel 10, with a specific note number for each drum sound. This is why a drum part uses note numbers as a kit map and not as pitches.

What do control change, program change and pitch bend do?

Control change. A control change message has a control number and a value, both from 0 to 127. Control 1 is the modulation wheel or lever, 7 is channel volume, and 64 is the sustain pedal, off at 63 and below and on at 64 and above. It adjusts parameters of the instrument while notes play.

Program change. It selects a sound, with a program number from 0 to 127. Program 0 may be a piano on one instrument and a flute on another, because nothing forces two instruments to agree.

Pitch bend. It varies the pitch continuously, like a pitch wheel. MIDI sends it as a 14-bit value, which gives 16,384 steps. General MIDI instruments start with a range of plus or minus 2 semitones.

What does a Standard MIDI File store?

A .mid file holds MIDI events with time stamps, grouped into tracks. It also stores tempo and time signature information, and may carry track names. The header gives the track count, the timing and one of three formats. Type 0 puts the whole performance on a single track, type 1 holds any number of tracks played together, and type 2, rarely used, holds separate sequences.

Events are time-stamped in ticks, the smallest unit of time a sequencer uses, and the file says how many ticks make up one quarter note. So a file counts in beats and not in seconds. Its timings turn into seconds only when a tempo is applied.

What is in the .mid from the converter?

The file from the Download .mid button is simple, and everything below comes from how the page writes it.

  • Format 0, one track. Everything is on a single track, so a full mix lands in one place with nothing to separate the parts.
  • 480 ticks per quarter note. At 120 BPM that is 960 ticks a second. A C4 held for half a second at 120 BPM is a note-on of 60 and, 480 ticks later, a note-off of 60.
  • The tempo you set. The Tempo field takes 20 to 300 and starts at 120. It is stored as microseconds per quarter note, 500,000 at 120 and 666,667 at 90. Notes keep their real times in seconds, so the tempo changes the bar grid your software draws and not when notes sound.
  • A 4/4 time signature. It is always written, whatever the music is.
  • Channel 1 only. Every note-on and note-off sits on channel 1.
  • Notes 21 to 108. The model reports the 88 piano keys, A0 to C8, so nothing outside them can appear. Lowest note and Highest note narrow this further.
  • Velocity 1 to 127. It is set from how strongly the model registered the note, not from how loudly it was played. Each note-off has a velocity of 0.
  • No program change, control change or pitch bend. Slides come out as steady notes, and the sound is whatever your software loads on that track.

The file takes its name from the audio file, with .mid at the end. What converts well covers which recordings give clean notes. If you do not know a song's tempo, how to find the BPM of a song shows how.

Why does the same file sound different on different instruments?

The file names notes and not sounds. One instrument may answer program 0 with a piano and another with a flute. Each also has its own samples or synthesis and its own tuning.

General MIDI was set up to narrow the gap. It provides a standard bank of 128 sounds with fixed program numbers, so a given program change selects the same kind of instrument on any compatible device. It narrows the gap and does not close it, because two pianos with the same program number still sound different. A file with no program change, like the one from the converter, leaves the choice to you.

What goes wrong most often?

  • Expecting a .mid to sound like the recording. It holds notes, not the audio.
  • Reading note 60 as C3 or C5 because a program labels octaves differently. This site uses C4.
  • Importing the file and finding the bars off. Set the project tempo to the tempo saved in the file.
  • Looking for drums on channel 10 in a file that has everything on channel 1.
  • Treating velocity from the converter as a dynamics map.
  • Assuming a tuning other than 440 Hz is stored in the file. It is not.

Sources

More guides