The Musical Instrument Digital Interface (MIDI) is a special port designed for transferring real-time musical performances between computers, musical keyboards and instruments, although the term ‘MIDI’ also refers to the data format itself. The connection to a computer is usually made via a MIDI adaptor, often confusingly known as a MIDI interface.

Unlike other modern serial ports, MIDI doesn’t operate as a bus. Instead, it provides a point-to-point connection that only conveys data in one direction. Typically, a musical keyboard is connected to a computer via a single MIDI cable, whilst a second cable connects the computer to an instrument. If a true bidirectional link is required between two devices, perhaps for handshaking during data transfer, you must use a cable in each direction. Fortunately this isn’t often required.

The data structure of a MIDI signal is similar to a traditional RS-232 serial interface but uses alternative hardware to minimise any electrical interference with adjacent audio circuits. 8-bit data is sent without parity at a comparatively slow speed of 31.25 bits per second (bits/s), ±1%. That’s equal to a data transfer rate of around 3000 bytes per second. Fortunately, by using a very clever data structure, the slowness of the interface rarely upsets the integrity of musical data.

Connections and Cables

MIDI connections are made by means of a cable fitted with a 5-pole 180° DIN plug at each end. This connector conforms to a German standard and was originally used for hi-fi purposes. The computer itself usually needs a MIDI adaptor or interface box, although some types of audio card or synthesiser card designed for a PCI slot often provide a MIDI connection.

MIDI adaptors commonly provide multiple outputs for feeding different messages to a number of musical synthesisers and usually have at least two inputs. In some instances, particularly where you have a lot of instruments that can’t fully use the capability of an entire MIDI circuit, you may need to feed a common MIDI signal to several devices. Fortunately, most MIDI equipment has a MIDI Thru socket. This replicates any data arriving at the input socket, allowing you to daisy-chain up to three devices. However, if you try to connect any more equipment you may suffer from erratic results.

Here are two simple, but very important, rules:-

Testing a MIDI Circuit

If you don’t have a computer with a MIDI adaptor (see below) it’s difficult to know if a device is sending data. Although a MIDI analyser can display the transmitted information, a simple light-emitting diode (LED) wired onto a DIN plug, as shown below, is often adequate. With practice, you can identify particular kinds of data from the way in which the LED flashes.

MIDI Adaptors

To use MIDI your computer needs a MIDI adaptor, sometimes confusingly known as a MIDI interface. A recent computer with Universal Serial Bus (USB) connections requires a modern USB to MIDI adaptor, whilst a ‘classic’ Mac OS machine with serial ports labelled as Modem or Printer needs a different adaptor fitted with matching connections.

Passive Adaptors

This low-cost variety of adaptor connects to a ‘classic’ Mac OS machine fitted with serial ports. The data travels in one direction between each MIDI socket (or sockets) and a port (or ports) on the computer. Duplicate MIDI outputs are often provided for feeding several devices at once, although you can also utilise the MIDI Thru sockets on your equipment.

Intelligent Adaptors

A typical intelligent adaptor can provide 15 MIDI inputs and outputs, or more. The data from each MIDI circuit is multiplexed within the adaptor and then sent to the computer’s port (or ports) at an accelerated rate. The data itself is ‘wrapped’ within extra codes that identify each MIDI circuit.

To TG Connections

Some MIDI adaptors incorporate this kind of port as well as standard MIDI circuits. The interface, developed by Yamaha from their original To Host connection system, conveys five sets of MIDI circuits via a single mini-DIN connector. Since each MIDI port conveys up to 16 MIDI channels, it can carry a total of 80 channels, although it can only be used with a synthesiser or sound generator that has a matching connector. If not, you’ll need a To TG to MIDI converter.

MIDI Connections in Detail

All standard MIDI cables are wired with a 5-pole 180° DIN plug at each end. The cable should contain twisted-pair conductors wired to pins 4 and 5, with the cable’s screen connected to pin 2 at each end. Note that the wires to pins 4 and 5 mustn’t be reversed and that the screen must never be connected to the metal case of either plug.

Although pins 1 and 3 of the plug aren’t used by normal MIDI circuits, some manufacturers use these connections for non-standard purposes. For this reason it’s best to use ready-made MIDI cables with all pins connected. For short distances especially, you can use hi-fi cables that have the required DIN connectors.

The total length of a MIDI circuit shouldn’t exceed 15 metres. Low capacitance cable can work over longer distances but this isn’t guaranteed not to cause odd behaviour. So, for reliable operation over a distance, you should use a MIDI to RS-422 converter and RS-422 to MIDI converter at each end of the link.

Some products, usually in the form of a PCI expansion card, provide MIDI via non-standard connectors for which you’ll need special cables. Some cards, usually designed for a PC, are fitted with a variant of the standard PC game port, also known as a joystick port. This is a 15-way D socket (DB15) that lets you connect two joysticks via a splitter cable. However, on these particular cards, a MIDI connection is also provided via this socket, necessitating another adaptor.

Using Audio Wiring for MIDI

MIDI can also be connected via audio XLR cables or jackfields that employ 3-pole connectors, as detailed in the table below, although ideally you should to keep MIDI away from other audio circuitry to minimise electrical interference.

CircuitDIN ​PlugXLR ​Connector3-pole ​Jack
Current ​Source43Ring

MIDI Interfacing

MIDI avoids earthing and interference problems by using a current loop that drives an opto-isolator connected to each MIDI input socket. Sometimes, such ‘optos’ suffer from erratic behaviour caused by timing errors, although modern high-speed devices have largely overcome this problem.

The current loop flows via pins 4 and 5 whilst pin 2 provides a screen circuit for the connecting cable. Note that the latter pin is only connected to ground at a MIDI output socket or MIDI Thru socket. The current flowing through the opto-isolator is interpreted as follows:-

No current = Idle or Logical 1

5 milliamp (mA) current flowing = Logical 0

The electrical schematic for a typical MIDI input is shown below, complete with a MIDI Thru connection:-

whilst a typical output circuit takes the following form:-

©Ray White 2004.