Practically MIDI (Part 1)
One for the DIY fans. In this new series, Martin Russ penetrates deep into the heart of MIDI equipment and explores how they work, what chips they use and more...
Martin Russ begins a new series on the practical aspects of the Musical Instrument Digital Interface with a look at the technical aspects of MIDI.
Things began to change when two Sequential wizards designed a digital interface for their Prophet 10 synthesizer. Although it was clumsy for general purpose use, its subsequent redesign led to the Universal Synthesizer Interface (USD, which appeared at the Autumn '81 Audio Engineering Society Convention. The USI replaced all those analogue CV and gate connections with a serial digital system, transmitting bytes of information representing note pitches and on/off (gate) information as digital data - remember, by now (the early '80s) the microprocessor was taking over everything.
From this beginning, a second meeting collected together interested parties from the US and Japan, resulting in a modified proposal by the Japanese which was integrated into a draft combined specification by Smith and Wood of Sequential. No further response came from the US but Sequential persevered, continuing discussions with Roland, Yamaha, Korg and Kawai. The resulting Musical Instrument Digital Interface (MIDI) discussion document was then fine tuned by Sequential and Roland, resulting in the first MIDI Specification issued by Sequential (then known as Sequential Circuits Inc, by the way) entitled 'The Complete SCI MIDI' - I got my draft copy early in 1983. For the Trivial Pursuiters amongst you, Bob Moog first announced MIDI in his column in America's Keyboard magazine in October 1982. MIDI had arrived! On the subject of Moog, it is interesting to note that the coming of the MIDI/Digital era marked the beginning of the decline of the Moog company, which produced the first commercial synthesizers in the '60s.
This series will not explain what MIDI is in software and computing terms, because there are already lots of articles covering this subject in great detail. The definitive work is, of course, Jay Chapman's 'Talking MIDI' series published in this very magazine from December 1985 to August 1986. Suffice it to say that MIDI appears on an instrument as two or three 5-pin 180 degree DIN sockets (or, exceptionally, as 5-pin XLR connectors) and employs two distinct types of byte. Status bytes have the most significant bit set to 1, whilst data bytes have the most significant bit set to 0. The format of status and data bytes is defined at a common minimal level so that note pitch and note on/off information can always be transferred between instruments.
For more advanced applications, MIDI provides 16 separate channels for transmitting and receiving data, configurable in several different operating modes, as well as some real-time controls.
Manufacturer-specific information is contained within a special system exclusive category and is used for things like voice dumps and remote editing.
This concludes the software overview. The rest of this series will discuss some of the practicalities of MIDI, and should be of particular interest to experimenters, customisers, engineers and MIDI buffs in general.
And so to the main event. Let's compare MIDI with some conventional interfaces.
MIDI is an asynchronous serial protocol running at 31.25Kbaud, using a 5mA current loop. For comparison, most computer to printer/modem connections utilise an RS232 interface, which uses TTL level signals at anything from 75 baud up to 9.6 Kbaud, and current loops in the realm of telex and telegraph systems. MIDI is serial, as is RS232, although the Centronics interface to printers uses a parallel format. In general, serial interfaces on computers are used for convenient connections between equipment where only relatively low data transfer rates are needed. Serial interfaces tend to be slow because of the time taken to squash parallel data bytes/words into a serial stream. For high rates parallel interfaces are used, although the cabling is more unwieldy and expensive. MIDI is unusual in respect of the high speed with which it pushes data down cables and this means that care is needed in designing the driver and receiver stages, as we shall see. The high speed was chosen because of the need to avoid the delays becoming objectionable. The serial format was chosen to simplify the cabling and connectors.
To avoid audio ground loops the input interface in MIDI is opto-coupled, a refinement which has removed many of the hum problems which used to bedevil pre-MIDI synthesizer set-ups. To the best of my knowledge, opto-coupling is not used in any computer interfaces except those used in medical applications (where you don't want to dump large currents through patients!). So MIDI is fast and uses a current loop rather than voltages - the speed serves to restrict the maximum length of MIDI cables to about 15 metres or less.
The current loop works in the opposite way to what you might expect: a 0 is indicated by current flowing, whilst a 1 is indicated by no current. Also, the current loop means that interfacing is on a strictly one-to-one basis - no DIN Y connectors allowed! Unlike RS232, MIDI is unidirectional in socket terms - there are separate input and output sockets. One MIDI In is the norm: this has the opto-coupler and no connection to the ground on the piece of equipment. One or more MIDI Outs send note and other information to other peripherals, and MIDI Thrus echo the information arriving at the In, thus enabling daisy-chaining of equipment.
Interestingly, the Thru does not produce any output originating within the piece of equipment on which it is fixed, so you do not get any note information from a synthesizer Thru. Since star connections are usually preferred when interconnecting devices, it is possible to buy so-called Thru boxes which take the MIDI data from an Out and produce several Outs in parallel. The reason these Outs are called Thrus is because relative to the In socket on the Thru box they are Thrus, whereas if you consider the actual overall effect of the equipment's MIDI Out and Thru box, it is the equivalent of a piece of equipment with multiple Outs.
The MIDI 1.0 Specification recommends the use of open collector 'LS TTL gates as MIDI Outs (and Thrus). Contrary to what you might expect, most 'LS open collector gates have conventional transistors as their output sinks, rather than Schottky transistors - so there are none of the speed or low saturation voltage characteristics you might expect. For a transmitted zero or low state, the output stage is biased into saturation, sinking current to ground through the output transistor. The current is sourced by the same power rail as the 'LS gate, passing through the cable to the MIDI In opto-isolator LED at the far end, back through the cable and so to the output transistor. Using the voltage rail in the transmitting equipment means that you need two wires and the shield/earth to transmit the signals, but has the advantage that you keep your loading symmetrical when driving the current.
Careful! Remember that with no earth connection between the two pieces of equipment, a double-insulated synthesizer with no ground connection will 'float', and could be at a few hundred volts relative to ground. Unless you have the audio leads connected between your two pieces of MIDI equipment and one is grounded, you can find some very strange things happening if you try to source current from a different power supply rail which is floating at a few hundred volts. Luckily, most equipment tends to float at only a few volts, but be careful when connecting an isolated synth used for headphone practice to something else - if you connect into the synth, the audio cable 'ground' is actually floating! Returning to the current loop, you can now see that the signals through the cable are the same, only travelling in opposite directions. The diode across the LED in the opto-isolator serves two purposes: it not only protects you from accidentally reverse-biasing the LED, but is also useful for terminating reflections from the cable and thus helps the system to work at high speed. The arrangement of current loop and protection diode means that incorrectly wired cables won't work and shouldn't damage anything.
The MIDI In connection is the part of the MIDI loop where a lot of the problems arise. The one fixed point of reference is that the MIDI ground/shield wire from the cable is not connected to Pin 2 of the DIN plug, as mentioned before, in order to avoid hum loops. Everything else can be variable.
The opto-isolator is the major source of problems. Fast opto-isolators cost more than sluggish ones and, often, marginal devices are used to save money in some designs. Some LEDs are more thirsty for current than others and this can cause problems. Some MIDI current loops can be running on about 3mA and some on about 12mA! - some designs leave out the series resistors, some double or halve their value. Theoretically, there should be three 220 ohm resistors, plus the diode, connected between the 5 volt rail and the MIDI Out current sink transistor.
As if components being missed out wasn't enough, the characteristics of the components can cause trouble too! Turning the LED on is generally faster than turning it off, and it is here that the active pull-up mentioned earlier pays dividends. LEDs in opto-couplers can also vary in their light output and, although opto-couplers guarantee a minimum current transfer ratio for a given input, in our case we can't be sure what the loop current will be!
1. Read and follow the MIDI Specification. (Distributed by the International MIDI Association, (Contact Details).)
2. Use 220 ohm resistors and the correct number in the right places.
3. Make sure you end up with a 5mA loop current (ie. measure it! - don't trust your calculations).
4. Use fast enough opto-isolators with Darlington outputs (design for about 3mA minimum current).
5. Buffer your MIDI Thrus directly from the In socket (minimise Thru delay).
6. Use the correct socket configurations (Atari ST computers combine the Thru and the Out into a single 5-pin DIN - don't do this!).
There is lots more to MIDI than this. The next article in this series will discuss how to add extra MIDI In, Outs and Thrus to your equipment. In the meantime, further more detailed technical information on MIDI can be found in Alan Robinson's excellent article in the January 1987 issue of Electronics Today International (ETI) magazine.
Feature by Martin Russ
mu:zines is the result of thousands of hours of effort, and will require many thousands more going forward to reach our goals of getting all this content online.
If you value this resource, you can support this project - it really helps!