Channel messages are the MIDI messages that play the music: notes, controllers, program changes and pitch bend. In a file they are stored exactly as they are sent down a MIDI cable, after the event’s delta time.
Status and data bytes
The status byte’s high four bits are the message and its low four bits the channel,
0 to 15, which people call channels 1 to 16. The data bytes that follow are
00 to 7F. The status byte can be left out when it repeats the
one before: see running
status.
| Status | Message | Data bytes |
|---|---|---|
8n | Note off | key, release velocity |
9n | Note on | key, velocity |
An | Polyphonic key pressure | key, pressure |
Bn | Control change | controller, value |
Cn | Program change | program |
Dn | Channel pressure | pressure |
En | Pitch bend | LSB, MSB |
In a number of the files examined for this site, all from one collection, a bank
select has the value FF (B9 00 FF), a data byte with its top
bit set; perhaps one sequencer wrote −1 for “no bank”. Because the explorer takes two
bytes for a control change whatever they are, it reads on correctly and marks the
byte. A strict reader stops there.
Keys
Keys are numbered 0 to 127, in semitones. Key 60 is middle C, which most software calls C4 and Yamaha calls C3; key 69 is the A above it. On channel 10 in General MIDI each key is a percussion sound instead of a pitch.
Note off
| Byte | Value | Meaning |
|---|---|---|
| 0 | 8n | Note off on channel n |
| 1 | 0 to 127 | The key |
| 2 | 0 to 127 | Release velocity: how quickly the key was let go. Most synthesisers ignore it; 64 is usual. |
Note on
| Byte | Value | Meaning |
|---|---|---|
| 0 | 9n | Note on on channel n |
| 1 | 0 to 127 | The key |
| 2 | 0 to 127 | Velocity: how hard the key was struck, 1 to 127. Velocity 0 means note off. |
Many writers end notes with a note on of velocity 0 instead of a note off, because a
run of note ons can then share one status byte under running status. For example
00 90 3C 64 then 60 3C 00 starts middle C and ends it 96
ticks later.
Pairing notes
The file stores starts and ends, not notes with a length. The explorer’s piano roll pairs them like this:
- A note starts at a note on with a velocity above 0.
- It ends at the next note off, or note on with velocity 0, for the same key on the same channel in the same track.
- When the same key is struck again before it is released, the ends close the notes first in, first out: the oldest note ends first.
- A note still sounding at the end of its track lasts until the track’s last event.
The specification does not say how to pair overlapping notes of the same key; first in, first out is the explorer’s choice, and other programs may close the newest note first.
Polyphonic key pressure
An, then the key and the pressure, 0 to 127: how hard a key that is
already down is pressed, key by key. Also called polyphonic aftertouch. Few keyboards
send it.
Control change
| Byte | Value | Meaning |
|---|---|---|
| 0 | Bn | Control change on channel n |
| 1 | 0 to 127 | The controller number: 0 to 119 are controllers, 120 to 127 are channel mode messages |
| 2 | 0 to 127 | The value |
A few controllers come in pairs for more precision: controllers 0 to 31 carry the high seven bits (MSB) and 32 to 63 the matching low seven bits (LSB). Controllers 64 to 69 are switches, off below 64 and on from 64.
Bank select (0 and 32) followed by a program change chooses a program from a bank. GS, XG and General MIDI 2 use this; General MIDI 1 has a single bank. Registered parameter 0, chosen with controllers 101 and 100 and set with data entry (6 and 38), is the pitch bend range.
Controller numbers
The numbers the explorer names:
| Number | Controller | Number | Controller |
|---|---|---|---|
| 0 | Bank select (MSB) | 64 | Sustain pedal |
| 1 | Modulation wheel | 65 | Portamento on/off |
| 2 | Breath controller | 66 | Sostenuto |
| 4 | Foot controller | 67 | Soft pedal |
| 5 | Portamento time | 68 | Legato footswitch |
| 6 | Data entry (MSB) | 69 | Hold 2 |
| 7 | Channel volume | 70–79 | Sound controllers 1 to 10: 70 sound variation, 71 timbre, 72 release time, 73 attack time, 74 brightness |
| 8 | Balance | 80–83 | General purpose 5 to 8 |
| 10 | Pan | 84 | Portamento control |
| 11 | Expression | 88 | High resolution velocity prefix |
| 12, 13 | Effect control 1, 2 | 91–95 | Effects 1 to 5 depth: reverb, tremolo, chorus, detune, phaser |
| 16–19 | General purpose 1 to 4 | 96, 97 | Data increment, data decrement |
| 32–63 | LSB for controllers 0 to 31 | 98, 99 | Non-registered parameter number, LSB and MSB |
| 100, 101 | Registered parameter number, LSB and MSB |
Numbers not in the table are undefined in MIDI 1.0, and the explorer shows them by number.
Channel mode messages
Control change numbers 120 to 127 are not controllers but commands to the channel:
| Number | Message |
|---|---|
| 120 | All sound off |
| 121 | Reset all controllers |
| 122 | Local control |
| 123 | All notes off |
| 124 | Omni mode off |
| 125 | Omni mode on |
| 126 | Mono mode on |
| 127 | Poly mode on |
Program change
Cn, then one data byte: the program, 0 to 127, the instrument the channel
plays from now on. People and most software number programs 1 to 128, one more than the
stored value; the explorer shows both. C0 51 stores 81, which is program 82,
Lead 2 (sawtooth) in General
MIDI. On channel 10, General MIDI 1 gives program changes no meaning.
Channel pressure
Dn, then one data byte: the pressure on the whole channel, 0 to 127, the
greatest pressure on any key that is down. Also called aftertouch.
Pitch bend
| Byte | Value | Meaning |
|---|---|---|
| 0 | En | Pitch bend on channel n |
| 1 | 0 to 127 | The low seven bits (LSB) |
| 2 | 0 to 127 | The high seven bits (MSB) |
The value is MSB × 128 + LSB, 0 to 16,383. 8,192 (00 40) is the centre,
no bend. The explorer shows it as −8,192 to +8,191 from the centre. How many semitones
the full bend reaches is not part of the file format: a synthesiser sets it, or the
file sets it with registered parameter 0.