tags: mus-407 midi

MIDI Message Format

A [midi] message consists of one or more [byte]s in the following format:

Example

Scenario: pressing and releasing a key on a MIDI keyboard controller

How many MIDI messages are generated? Two.

How many bytes are generated? Six. Each message contains three bytes:

Binary vs. Decimal Data

Every MIDI message starts with exactly one status byte followed by an arbitrary amount of data bytes.

Example:

Note-On Message, Deconstructed

10010010
Breaking up into sections, starting from left:
1 -> indicates status byte
001 -> message type, 8 possibilities (001 = note on)
0010 -> message channel, 16 possibilities: 0010: channel 3 (0-indexed)
00111100
Note number: 60 (decimal)
01100101
Note velocity: 101 (decimal)

Sources