Magazine Archive

Home -> Magazines -> Issues -> Articles in this issue -> View

Practically MIDI (Part 1)

Article from Sound On Sound, September 1987

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.

Once upon a time (OK - the late 70s), synthesizers were young and expensive, and were controlled by control voltages patched together by jack-to-jack cables. If you could find two polyphonic synthesizers (they were even newer and a lot more expensive) and wanted to connect them together then, assuming it was possible at all, you needed lots of wires carrying both pitch information (control voltages, where 1 volt change = 1 octave change) and gating information (where notes started and stopped). Dave Smith's 1977 designed, 5-note polyphonic, Prophet 5 synthesizer used a mere 10 jack sockets for the CV and gates, for example. Touch sensitivity threatened to add even more sockets. Even worse, most manufacturers seemed determined to make their equipment incompatible with everyone else's and you usually needed interface boxes to connect things together. Intel, by the way, had just designed the first microprocessor chip for a cash register, almost certainly without realising what they were starting. All this sounds very strange and alien, eh? - but the sort of interfacing problems you suffered by using analogue polysynths with far too many interconnections were to last until 1983...

THE BIRTH 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.

NOT WHAT YOU EXPECTED



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.


TECHNICALLY MIDI



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.

MIDI OUT



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 cable itself slows down the edges because of the parasitic capacitance between the two conductors and the shield/ground. The shield is only connected at the MIDI Out end, so that parasitically derived return currents flow along the MIDI cable from the far end to the driver end. This suggests that for maximum speed and reliability you should choose a low capacitance cable, preferably with two separately shielded signal wires (as per decent microphone cable). Decent braided screening will also help to keep everything under control. Cheap two-core overall screen cable (as per some hi-fi cables) is definitely not recommended! The best bet is to use the same sort of Belden look-alike cable that you would use for your best studio mics and, although the maximum recommended length of MIDI cables is about 15 metres, it's probably a lot safer to make up short cables of a metre or two for local use, ie. around a keyboard set-up.

One of my classic 'Help!' phone calls was from an 'Oh my goodness!' type studio person who could not get his MIDI to work reliably. On investigation it turned out that he was using MIDI cables about 5 metres long, and was using a master keyboard on one side of the studio connected to a slave synth on the other side of the studio, with a drum machine taking its clock from a tape machine sync box in the control room, etc, etc. The neatly tied up MIDI cables he used to interconnect the equipment added up to about 50 metres in total - 'I wasn't going to waste money on decent cable,' he said, 'it's only for MIDI'! It really does matter what sort of cable you use.

The output driver need not be an 'LS TTL open collector. It is perfectly feasible to use normal 'LS gates. In fact, the Schottky transistors and active pull-up can improve the performance over long/poor-quality cables. 'HC gates are even better at actively pulling up the output and turning the opto-isolator off, as well as having very low current consumption (useful in Thru boxes?). Discrete transistors (remember them?) can also be used, and at a pinch almost anything can sink a current of about 5mA (except some UARTs/ACIAs - always use a buffer!). If you want to be really naughty, you can always exploit the opto-coupler and run the loop at a voltage other than the standard 5 volts sinking to ground, since the opto-isolator is not connected to the far MIDI In electrically. But watch out for Thru boxes if you do this!

The reason I mention this non-standard voltage level is that some Thru boxes just convert from a single MIDI Out to lots of Outs without using an opto-isolator, using just TTL buffers. The official MIDI Specification does mention TTL levels but doesn't actually reference the levels to ground specifically, and so you could use 15 volts sinking to 10 volts, but I don't recommend it - RS232 is in a complete mess because of this 'specmanship'.

MIDI IN



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!


Once transformed into light by the LED, the MIDI data strikes the phototransistor and is converted back to a voltage. The pull-up resistor of the open collector opto-isolator output stage becomes important here, although using too small a value will only saturate the transistor and slow it down. Basically, the opto-isolator should be one with a better than 100% transfer ratio (ie. a Darlington output stage) for easy design without additional transistor stages to recover the MIDI data. The MIDI data from the opto-isolator is usually connected to the input of the ACIA/UART and the Thru driver, but some Thrus are driven from a separate output of the ACIA/UART. The Thru should be a simple copy of the incoming In signal. Any delays in transferring it will accumulate in long chains, so avoid designs which delay the Thru by processing it - some equipment can do merges using the In and the Thru, and these Thrus will definitely be delayed.

DESIGN NOTES



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!).

MORE DETAILS



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.


Series - "Practically MIDI"

Read the next part in this series:


All parts in this series:

Part 1 (Viewing) | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7 | Part 8


More from these topics


Browse by Topic:

Electronics / Build

MIDI



Previous Article in this issue

Kawai R50 Drum Machine

Next article in this issue

Roland MT-32


Publisher: Sound On Sound - SOS Publications Ltd.
The contents of this magazine are re-published here with the kind permission of SOS Publications Ltd.


The current copyright owner/s of this content may differ from the originally published copyright notice.
More details on copyright ownership...

 

Sound On Sound - Sep 1987

Topic:

Electronics / Build

MIDI


Series:

Practically MIDI

Part 1 (Viewing) | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7 | Part 8


Feature by Martin Russ

Previous article in this issue:

> Kawai R50 Drum Machine

Next article in this issue:

> Roland MT-32


Help Support The Things You Love

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!

Donations for October 2024
Issues donated this month: 0

New issues that have been donated or scanned for us this month.

Funds donated this month: £0.00

All donations and support are gratefully appreciated - thank you.


Magazines Needed - Can You Help?

Do you have any of these magazine issues?

> See all issues we need

If so, and you can donate, lend or scan them to help complete our archive, please get in touch via the Contribute page - thanks!

If you're enjoying the site, please consider supporting me to help build this archive...

...with a one time Donation, or a recurring Donation of just £2 a month. It really helps - thank you!
muzines_logo_02

Small Print

Terms of usePrivacy