MIDI
MIDI stands for the Musical Instrument Digital Interface. Although designed for communication between musical instruments, the protocol has been widely used for remote control and synchronisation in the entertainment technology industry. This is primarily because it is low cost and simple to implement.
MIDI is a bi-directional protocol that transfers data over an inexpensive current loop interface. The connector used is a 5-pin DIN. Cable distance is limited to 15m, however RS485 converters can be used to extend cables to several hundred metres.
MIDI is a point to point interface and cannot ‘loop through’. For this reason, most MIDI equipment is designed with Input, Output and Through connectors.
Data is transferred as asynchronous serial information at a baud rate of 31.25 Kbaud. (Note that data rate and baud rate are identical for MIDI. It is therefore valid to express the transmission speed in either baud or bits per second). Most MIDI messages consist of two or three characters. This means that it takes approximately 1mS to send a message. This is usually too slow for real time lighting control but is fine for triggering.
Structure
A MIDI message starts with a Status byte followed by one or more Data bytes. The status byte is identified by the most significant bit being set to one. This means that status bytes can take the range 128 to 255, while data bytes are limited to the range 0 to 127.
MIDI implements sixteen logical channels. This allows devices on a MIDI network to be individually addressed. Two types of message class exist. The Channel Messages (such as Note On) are sent to a specific MIDI channel. System Messages are sent to all devices connected to the network.
Channel Messages
Channel Messages encode the destination address or MIDI Channel in the low nibble of the status byte. The bits of the status byte are divided as follows:
1cccnnnn
– The nnnn part takes a value in the range 0 to 15 and is the MIDI Channel.
– The ccc part defines the actual MIDI message.
The following table defines these commands:
Message |
Hex |
Decimal |
Data byte count |
Note off |
8n |
128+n |
2 |
Note on |
9n |
144+n |
2 |
Polyphonic key pressure |
An |
160+n |
2 |
Control/Mode change |
Bn |
176+n |
2 |
Program change |
Cn |
192+n |
1 |
Monophonic channel pressure |
Dn |
208+n |
1 |
Pitch bend change |
En |
224+n |
2 |
System Messages
System Messages do not include a MIDI Channel, they ‘broadcast’ to all connected devices. There are three types of System Message:
– Common
System Common messages are intended for all connected devices. They include messages such as Song Select, Tune Request and MIDI Timecode.
– Real Time
System Real Time messages include items such as timing clock and song start/stop. Real Time messages can be inserted inside other multiple character messages.
– Exclusive
System Exclusive (SysEx) messages are used to transfer manufacturer specific information and data files between products.
Message |
Hex |
Decimal |
Data byte count |
System Exclusive | |||
System exclusive status |
F0 |
240 |
variable |
System Common | |||
MIDI Time Code (MTC) |
F1 |
241 |
1 |
Song position pointer |
F2 |
242 |
2 |
Song select |
F3 |
243 |
1 |
(Undefined) |
F4 |
244 |
0 |
(Undefined) |
F5 |
245 |
1 |
Tune request |
F6 |
246 |
0 |
End of exclusive (EOX) |
F7 |
247 |
0 |
System Real Time | |||
Timing clock |
F8 |
248 |
0 |
(Undefined) |
F9 |
249 |
0 |
Start |
FA |
250 |
0 |
Continue |
FB |
251 |
0 |
Stop |
FC |
252 |
0 |
(Undefined) |
FD |
253 |
0 |
Active sense |
FE |
254 |
0 |
System reset |
FF |
255 |
0 |