MIDI
Physical spec
MIDI signals are typically carried through DIN5 connectors (see image for socket pinout). Pin 4 is the current source/Vcc, pin 5 is the current sink/TX, and pin 2 is ground.
More compact devices may make use of a TRS connector instead. These come in a number of flavors:
| Type | Tip | Ring |
|---|---|---|
| Type A | Sink | Source |
| Type B | Source | Sink |
| Ring active | NC | Sink |
| Tip active | Sink | NC |
Messages
MIDI messages (other than SysEx) range from 1 to 3 bytes in length, transmitted as 8N1 serial UART at 31250 bps.
Messages in the first group (0x8nā0xEn) are channel messages; the lower nybble indicates the channel number (where 0 = channel 1, etc.). Though their parameters are full bytes, their values only range from 0x00ā0x7F.
| Command | Param 1 | Param 2 | Meaning |
|---|---|---|---|
| 0x8n | note | velocity | Note off |
| 0x9n | note | velocity | Note on |
| 0xAn | note | velocity | Polyphonic aftertouch |
| 0xBn | controller | value | Continuous controller |
| 0xCn | program | n/a | Program change |
| 0xDn | value | n/a | Channel aftertouch |
| 0xEn | LSB | MSB | Pitch bend |
| 0xF0 | ID | variable-size payload | SysEx start |
| 0xF1 | data | n/a | MIDI time code message |
| 0xF2 | LSB | MSB | Song position pointer |
| 0xF3 | song number | n/a | Song select |
| 0xF4 | n/a | n/a | undefined |
| 0xF5 | n/a | n/a | undefined |
| 0xF6 | n/a | n/a | Tune request |
| 0xF7 | n/a | n/a | SysEx end |
| 0xF8 | n/a | n/a | Clock (24 PPQ) |
| 0xF9 | n/a | n/a | undefined |
| 0xFA | n/a | n/a | Start |
| 0xFB | ? | n/a | Continue |
| 0xFC | n/a | n/a | Stop |
| 0xFD | n/a | n/a | undefined |
| 0xFE | n/a | n/a | Active sensing (keepalive) |
| 0xFF | n/a | n/a | System reset |
Notes
| MIDI note | Note | Frequency (Hz) | |
|---|---|---|---|
| 21 | A0 | 27.500 | |
| 22 | A#0/Bb0 | 29.135 | |
| 23 | B0 | 30.868 | |
| 24 | C1 | 32.703 | |
| 25 | C#1/Db1 | 34.648 | |
| 26 | D1 | 36.708 | |
| 27 | D#1/Eb1 | 38.891 | |
| 28 | E1 | 41.203 | |
| 29 | F1 | 43.654 | |
| 30 | F#1/Gb1 | 46.249 | |
| 31 | G1 | 48.999 | |
| 32 | G#1/Ab1 | 51.913 | |
| 33 | A1 | 55.000 | |
| 34 | A#1/Bb1 | 58.270 | |
| 35 | B1 | 61.735 | |
| 36 | C2 | 65.406 | |
| 37 | C#2/Db2 | 69.296 | |
| 38 | D2 | 73.416 | |
| 39 | D#2/Eb2 | 77.782 | |
| 40 | E2 | 82.407 | |
| 41 | F2 | 87.307 | |
| 42 | F#2/Gb2 | 92.499 | |
| 43 | G2 | 97.999 | |
| 44 | G#2/Ab2 | 103.83 | |
| 45 | A2 | 110.00 | |
| 46 | A#2/Bb2 | 116.54 | |
| 47 | B2 | 123.47 | |
| 48 | C3 | 130.81 | |
| 49 | C#3/Db3 | 138.59 | |
| 50 | D3 | 146.83 | |
| 51 | D#3/Eb3 | 155.56 | |
| 52 | E3 | 164.81 | |
| 53 | F3 | 174.61 | |
| 54 | F#3/Gb3 | 185.00 | |
| 55 | G3 | 196.00 | |
| 56 | G#3/Ab3 | 207.65 | |
| 57 | A3 | 220.00 | |
| 58 | A#3/Bb3 | 233.08 | |
| 59 | B3 | 246.94 | |
| 60 | C4 | 261.63 | |
| 61 | C#4/Db4 | 277.18 | |
| 62 | D4 | 293.67 | |
| 63 | D#4/Eb4 | 311.13 | |
| 64 | E4 | 329.63 | |
| 65 | F4 | 349.23 | |
| 66 | F#4/Gb4 | 369.99 | |
| 67 | G4 | 392.00 | |
| 68 | G#4/Ab4 | 415.30 | |
| 69 | A4 | 440.00 | |
| 70 | A#4/Bb4 | 466.16 | |
| 71 | B4 | 493.88 | |
| 72 | C5 | 523.35 | |
| 73 | C#5/Db5 | 554.37 | |
| 74 | D5 | 587.33 | |
| 75 | D#5/Eb5 | 622.25 | |
| 76 | E5 | 659.26 | |
| 77 | F5 | 698.46 | |
| 78 | F#5/Gb5 | 739.99 | |
| 79 | G5 | 783.99 | |
| 80 | G#5/Ab5 | 830.61 | |
| 81 | A5 | 880.00 | |
| 82 | A#5/Bb5 | 932.33 | |
| 83 | B5 | 987.77 | |
| 84 | C6 | 1046.5 | |
| 85 | C#6/Db6 | 1108.7 | |
| 86 | D6 | 1174.4 | |
| 87 | D#6/Eb6 | 1244.5 | |
| 88 | E6 | 1318.5 | |
| 89 | F6 | 1396.9 | |
| 90 | F#6/Gb6 | 1480.0 | |
| 91 | G6 | 1568.0 | |
| 92 | G#6/Ab6 | 1661.2 | |
| 93 | A6 | 1760.0 | |
| 94 | A#6/Bb6 | 1864.7 | |
| 95 | B6 | 1975.5 | |
| 96 | C7 | 2093.0 | |
| 97 | C#7/Db7 | 2217.5 | |
| 98 | D7 | 2349.3 | |
| 99 | D#7/Eb7 | 2489.0 | |
| 100 | E7 | 2637.0 | |
| 101 | F7 | 2793.0 | |
| 102 | F#7/Gb7 | 2960.0 | |
| 103 | G7 | 3136.0 | |
| 104 | G#7/Ab7 | 3322.4 | |
| 105 | A7 | 3520.0 | |
| 106 | A#7/Bb7 | 3729.3 | |
| 107 | B7 | 3951.1 | |
| 108 | C8 | 4186.0 |