MIDI Basics
- MIDI is always transmitted in 8 bit chunks (bytes) - A MIDI Message will be 2 or 3 bytes (therefore, 16 or 24 bits)
- The first Byte in a MIDI message is the STATUS BYTE. It says what the message is (e.g. Note On or Volume Change), and what MIDI channel it is on.
- The next one or two bytes are DATA BYTES. They give information such as what the note is and what velocity it is.
The Status Byte
-
The first bit (Most Significant Bit) is always 1 in a status byte
-
The next three say what type of message it is. There can therefore be 8 (2 Cubed) different types of message.
| If the status byte is |
|---|
| 000 Note Off |
| 001 Note On |
| 010 Polyphonic Aftertouch |
| 011 MIDI Control Change |
| 100 Patch Change |
| 101 Channel Aftertouch |
| 110 Pitch Bend |
*The specials are messages like start/stop song, time code/clock messages, and sys-ex.
- The last four bits give the channel number.
- The specials do not have channels, and instead the last 4 bits give more types of message.
Data Bytes
- The MSB in a data byte is always 0
- This leaves 7 bits to give a data value, which means each data byte can carry 128 values
- What the data bytes represent depends on the status byte
| If the status byte is | The Data Bytes are |
|---|---|
| 000 Note Off | Note + Release Velocity |
| 001 Note On | Note + Velocity |
| 010 Polyphonic Aftertouch | Note + Pressure |
| 011 MIDI Control Change | Controller Type + Value |
| 100 Patch Change | Patch Number |
| 101 Channel Aftertouch | Pressure |
| 110 Pitch Bend | Coarse Value + Fine Value |
- Most data bytes just run on a scale from 0-127, thus velocity can be anywhere between 0 (0000000) and 127 (1111111)
- Note information is carried by one data byte, so there can be 128 MIDI notes (from C-1 to G9).
- Similarly there can be 128 types of MIDI controller, and 128 different sounds (patches).
- Pitch bend information is carried by two data bytes so the pitch wheel has 16384 values (128x128)
- Patch Change and Channel Aftertouch only have one data byte.
- The “Note Off” command is not often used because most keyboards do not support release velocity. Instead, a “Note On” command with velocity 0 is sent.
Example MIDI Messages
NOTE ON (Middle C)
| Status Byte: | ||
|---|---|---|
| 1 | 001 | 0001 |
| status byte | Note On | Channel 2 |
| Data Byte | |
|---|---|
| 0 | 0111100 |
| Data byte | Note 60 (0111100 binary = 60 decimal) = C4 |
| Data Byte 2 | |
|---|---|
| 0 | 1100100 |
| Data byte | Velocity of 100 |