Baud
All protocols

MIDI

Music as three-byte messages on a 31,250 baud serial line.

What a Note On means

Three bytes, split into bits: the top bit marks status versus data, and the rest carry type, channel, note and velocity.

MIDI Note On · 3 bytes090100100003C001111006401100100Mess…ChannelNote numberVelocityClick a field to inspect it

Whole frame

Three bytes say: channel 1, play note 60 (middle C), at velocity 100. The top bit of each byte tells status from data, so a receiver that joins mid-stream resynchronises on the next status byte.

FieldOffsetExample valueMeaning
Status flagByte 0, bit 711 = this byte starts a message
Message typeByte 0, bits 6–4001 = Note On001 = Note On. Other types: 000 Note Off, 010 poly pressure, 011 control change, 100 program change, 101 channel pressure, 110 pitch bend.
ChannelByte 0, bits 3–00 = channel 10–15 on the wire, shown to musicians as channel 1–16. 0 = channel 1.
Data flagByte 1, bit 700 = a data byte, so only 7 bits remain for the value
Note numberByte 1, bits 6–060 = C4 (middle C)0–127. 60 is middle C (C4); each +1 is one semitone. 69 is A4 = 440 Hz.
Data flagByte 2, bit 700 again: every data byte keeps the top bit clear
VelocityByte 2, bits 6–0100 (fairly loud)0–127: how hard the key was pressed. 0 means Note Off.

Overview

MIDI 1.0 (1983) lets keyboards, synthesizers and computers talk. It is not audio: it carries events such as 'key pressed' and 'knob turned'. The wire format is a UART at 31,250 baud, and each message is one status byte followed by one or two data bytes.

The design trick is the top bit: status bytes have it set (0x80–0xFF), data bytes have it clear (0x00–0x7F). A receiver can join the stream at any moment and find message boundaries.

Key facts

Wires
Current loop on 5-pin DIN (or USB)
Speed
31,250 baud (8N1)
Message size
1–3 bytes (+ SysEx)
Channels
16
Note range
0 – 127
Direction
One way per cable

The same message on the wire

Underneath it is plain UART: start bit, eight data bits least significant first, stop bit, three times.

MIDI0S0D00D10D20D31D40D50D61D71P0S0D00D11D21D31D41D50D60D71P0S0D00D11D20D30D41D51D60D71PS…Status 0x90S…S…Note 0x3C (C4)S…S…Velocity 0x64S…FieldByte 171605041302010000x90144Byte 270605141312110000x3C60Byte 370615140302110000x64100

Whole frame

One note-on takes about one millisecond on the wire: 30 bits at 31,250 baud. Ten notes at once take 10 ms, which is why dense chords can smear in old MIDI gear.

  1. Start

    Start bit, always 0: the same UART framing as any serial port. MIDI is simply UART at 31,250 baud, 8 data bits, no parity, 1 stop bit.

  2. Status 0x90

    The status byte: the top bit is 1 (that is how a receiver tells status bytes from data bytes), 001 means Note On, and the low nibble 0 is MIDI channel 1.

  3. Stop

    Stop bit, always 1. Note the whole message is 3 × 10 = 30 bit times, about 0.96 ms.

  4. Note 0x3C (C4)

    Data byte 1: the note number. Data bytes always have a top bit of 0, leaving 7 bits (0–127). 0x3C = 60 = middle C.

  5. Velocity 0x64

    Data byte 2: how hard the key was struck, 0x64 = 100 out of 127. A Note On with velocity 0 is treated as Note Off.

Running status

When consecutive messages share a status byte, the sender may leave it out. This was a bandwidth saver on a slow cable.

A chord with running status · 7 bytes0490100100003C0011110064011001004001000000640110010043010000116401100100Status 0x90Note 60 (C4)Velocity 100Note 64 (E4)Velocity 100Note 67 (G4)Velocity 100Click a field to inspect it

Whole frame

Running status drops repeated status bytes. A C major chord goes out in 7 bytes instead of 9, a 22% saving that mattered a lot on a 31,250 baud cable.

FieldOffsetExample valueMeaning
Status 0x90Byte 0Note On ch.1Sent once: Note On, channel 1.
Note 60 (C4)Byte 10x3C = 60First note: C4.
Velocity 100Byte 20x64 = 100How hard: 100.
Note 64 (E4)Byte 30x40 = 64 = E4No status byte here! A receiver that sees a data byte (top bit 0) reuses the previous status. This is running status: the second note costs 2 bytes instead of 3.
Velocity 100Byte 40x64 = 100Velocity for the second note.
Note 67 (G4)Byte 50x43 = 67 = G4A third note, again without a status byte: the C-major triad C4-E4-G4 is complete.
Velocity 100Byte 60x64 = 100Velocity for the third note. Total: 7 bytes instead of 9.

Where you meet it

  • Keyboards, drum pads and controllers talking to a DAW or synth
  • Stage lighting and show control (MIDI Show Control)
  • USB-MIDI and Bluetooth-MIDI carry the very same messages

Watch out for

  • The wire format is not 38400 or 115200: it is exactly 31,250 baud, which is 1 MHz / 32. Plain PC serial ports cannot do it; microcontrollers can.
  • Channels are 0–15 on the wire but 1–16 on screens. Off-by-one confusion is common.
  • A stuck note usually means a Note Off was lost. Many devices respond to 'All Notes Off' (controller 123).

Standards

  • MIDI 1.0 Detailed Specification (MIDI Manufacturers Association)

Related protocols