tags: mus-407 midi
MIDI Message Format
A [midi] message consists of one or more [byte]s in the following format:
a status byte followed by zero, one, or two data bytes
status bytes begin with a
1
, data bytes begin with a0
1 byte = 8 bits
1 [bit] = smallest digital unit, corresponding to zero or one ("off" or "on")
a UART chip (Universal Asynchronous Receiver/Transmitter) receives and processes binary signal into usable data
MIDI messages sent at 31,250 bits/sec
- exact division of 1 mHz to facilitate synchronization with early CPUs
Example
Scenario: pressing and releasing a key on a MIDI keyboard controller
How many MIDI messages are generated? Two.
- A note-on message when we press the key
- A note-off message when we release the key
How many bytes are generated? Six. Each message contains three bytes:
- A status byte specifying message type and channel
- A data byte specifying note number
- A data byte specifying note velocity
Binary vs. Decimal Data
Every MIDI message starts with exactly one status byte followed by an arbitrary amount of data bytes.
Example:
- A MIDI Note On message starts with a status byte indicating that it is a 'Note On' message, followed by additional metadata such as key number, velocity, etc.
Note-On Message, Deconstructed
10010010Breaking up into sections, starting from left:1 -> indicates status byte001 -> message type, 8 possibilities (001 = note on)0010 -> message channel, 16 possibilities: 0010: channel 3 (0-indexed)
00111100Note number: 60 (decimal)
01100101Note velocity: 101 (decimal)
Sources
- MUS 407 MIDI