Skip to content

learn / how midi works

MIDI is not sound.It's the instructions.

A MIDI keyboard doesn't send audio. When you press a key it sends three small numbers: a key went down, which key, and how hard. The instrument at the other end makes the sound. Press a key and follow them down the cable.

Controller · MIDI out

Click or touch the keys, or play A–K on your computer keyboard.

Synth · MIDI in
-- -- --
msgwaiting
note--
vel--

Bytes are shown about 300× slower than they really travel. A real note takes under a millisecond.

01

Anatomy of a message

Every MIDI byte is 8 bits, and the first bit is the trick. If it's 1, the byte is a status byte: it says what kind of message this is, and on which channel. If it's 0, it's a data byte, carrying a value from 0 to 127. That's why so much in MIDI goes up to 127.

Channel
1
Note
Velocity

Click any bit to flip it. Try turning the first bit of a data byte on.

02

Sixteen channels, one cable

The low four bits of a status byte pick one of 16 channels. One cable can carry a whole band: piano on channel 1, bass on 2, lead on 3, and drums on 10, where General MIDI puts them. Every instrument listens to its own channel and ignores the rest. The messages are interleaved on one wire, one byte after another.

Click a channel to stop that instrument listening.

03

The wire: 31,250 bits a second

On a classic 5-pin cable, MIDI is a serial signal: one bit after another, at 31,250 bits per second. Each byte is framed by a start bit and a stop bit, so 10 bits travel for every 8. The data bits go lowest first. Play a note to see your message on the line.

MIDI out · bits on the line 90 3C 64
One bit32µs
One byte320µs, with start and stop
One note0.96ms, three bytes
Per second~1,000note messages, at most

Why a big chord is never quite together

Ten fingers make ten note-on messages, sent one after another. With running status, a sender can skip a status byte that's the same as the last one, and the chord gets there sooner.

9.6 ms for the whole chord · 30 bytes

Five pins, three used

1 4 2 5 3

Hover or tap a pin.

The signal is a 5 mA current loop, not a voltage. At the input it lights an LED inside an optocoupler, so the two devices are never electrically joined, and there are no ground-loop hums.

04

Knobs, wheels and pedals

Anything that isn't a key is a control change: 128 numbered controllers, each with a value from 0 to 127. Turning a knob sends a stream of them. The pitch wheel gets its own message with 14 bits, two data bytes glued together, so a bend sounds smooth instead of stepped.

Cutoff · CC 74 64
Pitch bend 0
Sustain · CC 64 off
05

Keeping time

To play in sync, one device becomes the clock and sends a one-byte timing clock message, F8, 24 times per quarter note. Drum machines and sequencers count the ticks and follow along. FA starts them, FC stops them. Clock bytes are so important they may cut into the middle of any other message.

120 BPM
Tick every20.8ms
Ticks sent0
06

MIDI on disk

A .mid file stores the same messages with a time stamp in front of each one: the number of ticks since the previous event. Those gaps can be small or huge, so they're written as variable-length numbers: 7 bits per byte, and the top bit says "another byte follows".

Variable-length numbers

Everything you played, as a file

Open it in the inspector
07

Forty years of three bytes

MIDI was agreed by competing companies in 1983, on hardware slower than a modern toaster. It still runs nearly every studio, stage and music app.

  1. 1970s

    Every maker speaks its own language

    Synths are linked with control voltages and gate signals, or with private digital buses. A Moog cannot reliably play an ARP, and a Roland sequencer only talks to Rolands.

    ?? ?? ??
  2. 1981

    A universal interface is proposed

    Roland founder Ikutaro Kakehashi pushes for a common standard. Dave Smith and Chet Wood of Sequential Circuits present the "Universal Synthesizer Interface" at the AES convention in New York.

    USI
  3. 1983

    Two brands, one cable

    At the winter NAMM show a Sequential Prophet-600 plays a Roland Jupiter-6 over a single 5-pin cable. The MIDI 1.0 specification is published that year, and the Yamaha DX7 brings MIDI to everyone.

    90 3C 64
  4. 1985

    The computer joins the band

    The Atari ST ships with MIDI ports built in. Sequencer software turns home computers into recording studios, and MIDI becomes the backbone of pop production.

    F8 F8 F8
  5. 1987

    MIDI Time Code

    MIDI learns to carry SMPTE time code, so sequencers, tape machines and video can lock to the same hour, minute, second and frame.

    F1 0n
  6. 1988

    Standard MIDI Files

    The .mid format lets any program save and open the same song: tracks of timed MIDI events, tempo and time signature, in a few kilobytes.

    4D 54 68 64
  7. 1991

    General MIDI

    A fixed list of 128 instruments and a drum map on channel 10. Program 1 is always a piano, note 36 always a kick. Sound cards, games and karaoke files can finally play the same song the same way.

    C0 00
  8. 1999

    MIDI over USB

    The USB MIDI device class lets keyboards plug straight into computers with no interface box. Over time the 5-pin port becomes optional on many controllers.

    09 90 3C 64
  9. 2006

    MIDI over the network

    RTP-MIDI sends MIDI over Ethernet and Wi-Fi. Studios start running MIDI between rooms and machines over ordinary networks.

    RTP
  10. 2013

    A Grammy for a protocol

    Ikutaro Kakehashi and Dave Smith receive a Technical Grammy Award for creating MIDI, 30 years after the first demo.

    F0 … F7
  11. 2015

    MIDI in the browser and over Bluetooth

    Chrome ships the Web MIDI API, so a web page can talk to your keyboard (this one does). The same year, MIDI over Bluetooth LE is standardised.

    navigator.requestMIDIAccess()
  12. 2018

    MPE: expression per note

    MIDI Polyphonic Expression gives every note its own channel, so each finger can bend, slide and press on its own. Made for instruments like the ROLI Seaboard and LinnStrument.

    E1 … E2 … E3
  13. 2020

    MIDI 2.0

    The first big update in 37 years: 32-bit controller values, 16-bit velocity, per-note controllers, and devices that can ask each other what they can do. MIDI 1.0 messages still work.

    40 90 3C 00 FF FF 00 00
  14. Today

    Still three bytes

    A keyboard from 1983 can still play a soft synth made this year. The note on you sent at the top of this page is the same message the Prophet-600 sent.

    90 3C 64