Classic Computer Magazine Archive START VOL. 4 NO. 12 / JULY 1990

Getting Started


THE INS, OUTS AND THRUS OF MIDI

A Beginner's Guide


(Editor's Note: In the Spring 1987 issue of START, professional musician Tom Jefferies wrote an extensive beginner's guide to MIDI. Well, we thought it was so good that we decided to reprint it this issue. For a tutorial on programming in MIDI, see Steve Johns' "MIDI Programming Tips" in this issue.)


A surprising thing happened in 1982. Several of the leading manufacturers of electronic musical instruments, normally fierce competitors, decided to sit down together and develop a means whereby their instruments could communicate with each other. They wanted to set things up so that a synthesizer from company A could drive a drum machine from company B or even a synthesizer from company C.

midiinout1.gif
Figure 1

Why? Well, for several reasons. It was, and is, very useful to have more than one synthesizer playing the same part. You can often get considerably more interesting sounds using two different instruments than you could with any one instrument, a fact well known to classical composers. However, it's difficult for a single player to play several instruments at the same time, and rock bands generally don't carry more than one keyboard player.

Hardware devices called sequencers(actually dedicated computers) were coming into use. The problem was that a sequencer put out by one company would not work with a synth or drum machine put out by another company. Sound familiar?

Synchronization was also an issue. Drum machines were becoming popular, and many people wanted an easy way to synchronize their keyboards to their drum machines and vice-versa.

So, in a move that should be an example to the computer industry, these brave souls carved out a hardware and software standard that defines exactlyhow electronic musical instruments would communicate. They named their invention Musical Instrument Digital Interface, or MIDI.

Communication between musical instruments and personal computers was not the primary concern of the MIDI developers, but since in reality almost all digital synths, drum machines, and sequencers are dedicated computers, it was natural that the MIDI standard turned out to work so well with computers.


How MIDI Works

Let's take a look at how MIDI actually works. Suppose you have a MIDI-equipped synth and have attached a MIDI cable from the MIDI Out port of your synth to the MIDI In port of your ST (Figure 1). Every time you press down a key on your synth it will send a message over the MIDI cable to the ST telling it a key was pressed down ("note-on event" in MIDI jargon), which key it was, and how hard you pressed the key. (The latter is particularly useful with "velocity sensitive" keyboards, such as the Yamaha DX-7.)

A different signal is sent when you release that key. This signal will be a "note-off event" (logical enough), and will also specify which key was involved and, on some synthesizers, will tell how quickly the key was released.

You can see that if your computer is keeping track of these signals, and the amount of time between them, it now has a record of which notes you have played and how long they were. The software doing this is called a sequencer; I'll discuss it in some detail in the section on software.

Now, if you have a MIDI cable running from the MIDI Out port of your ST to the MIDI In port of your synth, and the proper software, your computer can make your synth play back the notes you played on the synth in the first place. All the software has to do is send those same "note-on" and "note-off" signals it saved, making sure it waits the appropriate amounts of time between notes.

Since MIDI sequencers function, in many ways, like tape recorders, there are some persistent misconceptions. MIDI sequencers do not "record" music like a tape recorder. They record a series, or sequence of events: note-on events, note-off events, pitch-bend events and so on, that are produced by an electronic musical instrument equipped with the appropriate MIDI hardware and internal software. A MIDI sequencer cannot record your voice, unless you can find a way to equip your vocal chords with a MIDI Out port.

The wonders of MIDI come from the fact that the list of events you store in your computer can be treated as data and manipulated in many ways, just as a word processor allows you to manipulate your words much more easily than you can on a typewriter.

The MIDI standard provides for 16 channels of communication. This means your ST could send a different set of notes (in the form of note-on and note-off events) to 16 different synthesizers, or even to 16 different sets of synths, with all of the synths in each group set to the same channel. In reality, such a system is rare, mostly because of the expense, and MIDI does run into some trouble when it is pushed that hard, but the capability is there.


Non-Professional Uses of MIDI

MIDI was designed for professional electronic musicians, and has become extraordinarily popular with them. MIDI is such a useful tool, however, that it was only a matter of time before it came into general use. With synthesizers dropping in price to the point that you can buy a very useful instrument for $300 or so, a lot of people who do not make their living by music are buying instruments and MIDI software.

An example of non-professional MIDI software is Activision's popular Music Studio (Editor's Note: Dr. T's new Tiger Cub is also geared toward beginners.)With the mouse, you enter a series of notes on a staff and can play them back either through the ST's sound chip or through any MIDI-equipped synth. The program is too limited for professional use but is highly entertaining and educational. It has quite a strong following from music hobbyists, resulting in hundreds of song files available from user's groups and bulletin board systems such as CompuServe and GEnie. It doesn't really fit into any category--it's not a sequencer since it doesn't record notes in real-time from the synth, but it's fun!

Another clever use of MIDI comes from QRS, the people who sell mechanical piano rolls. They have converted many of their piano rolls to MIDI data and sell a program called MIDI Magic that plays them back while displaying a moving piano roll on the screen. I'm biased about this program, since I wrote the Atari ST version, but I enjoy listening to George Gershwin playing my Casio CZ-101 while I watch his piano technique on my computer screen.

There's a huge potential for MIDI as an educational tool, but it's still largely undeveloped. (Are you listening, software companies?) MIDI also takes away some of the need for years of intensive training in the physical act of playing, considered "paying your dues" by performing musicians. The transition from amateur to professional may well become easier because of MIDI. The jury is still out on whether or not this is a good thing, but technology evolves whether we like it or not, and music is no exception.


MIDI Software

The most important kind of MIDI software is the sequencer. In its simplest form, a sequencer stores the sequence of events (or notes) coming in over MIDI so they can be played back either through the same synth or through any other MIDI equipped synthesizer.

Note that last bit. Once you've stored the sequence, you can play it back over any instrument or instruments you want, as long as the receiving instrument is properly equipped. This means you can prepare a piece of music at home on a relatively inexpensive keyboard, then go into the recording studio with the best equipment you can rent or borrow for the actual session.

Even more significant is the manipulation you can do on the music once it's stored. The best sequencers allow you to edit each note of your music much like a document in a word processor. Missed a note? Take it out and put in the right one!

In addition, with a good sequencer, you can transpose the notes, "quantize" them (take out certain kinds of rhythmic imperfections), add dynamic changes (changes in the loudness), set up repeating patterns, and overdub. You could also record one line, or track, at a time. Many sequencers actually allow you to exceed your synth's capabilities several times over.

Although sequencers were developed for professional musicians, they can be just as useful to amateurs. A good professional sequencer, however, can cost several hundred dollars. Several companies are selling "consumer" sequencers for under $100; but as with all software purchases, make sure what you're getting. Some of the inexpensive packages offer little or no editing. Those of us who are not expert keyboard players need more editing facilities than, say, Jan Hammer or Stevie Wonder. Unless your fingers never miss when they tickle the ivories, look for a sequencer that lets you edit individual notes.

There are some other, very useful, kinds of MIDI software, such as patch editors and librarians. The sounds produced by a synthesizer are determined by the "patch" the synth is set to (the term is a holdover from the 1960s when synthesizers consisted of modules connected with patch wires; you set the sound by plugging and unplugging wires). Most synths will hold only a limited number of patches, and patch storage with plug-in cartridges gets expensive very quickly when the cartridges for some leading synths cost $75 or so apiece.

Floppy disks, however, are pretty cheap, and it didn't take long for people to start writing programs to get the patches from the synth and store them on disk. Programs that do this are called patch librarians.

Originally, patch librarians just worked with a single kind of synthesizer, so, if you had four different synths you had to buy four different patch librarians. That got old quickly, especially since the synthesizer manufacturers kept coming out with new machines. So, somebody got the bright idea of writing universal patch librarians that could handle patch information from a variety of synths. This gets difficult also, since every synth has a different way of storing its patch data and the software companies have to keep updating their software to match new instruments, but from the user's point of view it's a vast improvement.

Patch editors are often confused with patch librarians, but, although there is some overlap they really serve quite different functions. Most synths are very complex machines, and the process of setting up a really interesting sound on them can be extremely difficult and time consuming since they only provide buttons (and maybe a slider or two) for input and a tiny LED display to let you know what's going on.

A computer, with its full screen display, keyboard, and, in the case of the ST, a mouse, is a much better environment for editing the sounds or patches to be used by the synth. A program allowing you to edit patches is called, reasonably enough, a patch editor. Some patch editors even employ artificial intelligence principles, facilitating the creation of new sounds.

Patch editors normally include patch librarian functions. They only function with a single synthesizer, however, because the inner workings of each synth are so different it is not really possible to build an editor that will deal with all of them.

Now companies market patch editors that can be co-resident in memory and work in conjunction with a sequencer, letting you have your cake and eat it too. This is only possible with computers like the ST, providing large amounts of memory at reasonable prices.

There are several other types of MIDI software. There are filters that change the data coming from one synthesizer on its way to another. There are composition programs that generate pieces of a composition according to rules you set out. There are score printing programs that, while not MIDI based, can read a file from a MIDI sequencer and turn it into printed music.


MIDI and the ST

The MIDI interface was designed to be inexpensive and easy to implement; still it was a pleasant surprise when Atari announced they were going to include it in the ST. With other computers you had to spend between $50 and $450 to add a MIDI interface.

Atari did a reasonably good job of it, too. They provide the standard 5-pin DIN connectors for MIDI In and MIDI Out, attached to the internal circuitry of your ST through devices called optoisolators which prevent certain kinds of noise which occurs because of connections between your computer and your synth.


MIDI Cables

Unfortunately, Atari decided to get fancy and included a feature called MIDI-thru without spending the money to add another 5-pin DIN plug for it. A MIDI-thru port simply copies exactly what is coming in the MIDI In port and sends it through unaltered. So, if you are playing on a MIDI-controller keyboard that doesn't produce any sound you can hook up a synth which willproduce a sound to the MIDI-thru and hear what you are playing into the sequencer.

According to the MIDI standard, only three of the five pins of the MIDI Out port should be used. Atari connected the two signal lines (the third line is used for shield/ground) from the MIDI In port to the two unused lines on the MIDI Out port. The idea was to provide MIDI-thru, although such a non-standard implementation should have been called something else to avoid confusion in the first place.

Atari's version of MIDI-thru isn't much use without some kind of adapter that will split the signal into a proper MIDI Out and MIDI-thru, so I have provided directions to build this extremely simple adapter. Limited usefulness, however, is not the biggest problem with the "MIDI-thru" on your ST.

Not long ago I wrote a commercially-available patch editor for the Casio CZ-101, 1000, 3000, and 5000. It was quite popular, but customers called us, saying it caused their synthesizers to lock up or exhibit other bizarre behavior. Long discussions with Casio, many experiments, and considerable hair-tearing were to no avail. The worst thing was that we could not recreate the problems on our equipment.

Finally, one of the customers having this difficulty took a look at the cable he was using. Much to his (and our) surprise, it had the two pins which should be unused wired to the two signal pins. Since the unused pins on the Atari MIDI Out were sending a copy of the MIDI In signal, the handshaking required to exchange patches with the synths was impossible. In fact, the effect was so confusing to the CZ it locked up.

Both Atari and the company making the cables had deviated from the standard, although with non-malevolent intentions. Both, however, assumed that no one else would deviate from the standard. Unfortunately, they were incorrect in that assumption.

There are two solutions to this problem. One is to cut the wires connected to pins 1 and 3 (the two outermost pins) on the cable you connect to the MIDI Out port on your ST. The second is to run down to your local electronic parts house, pick up a few inexpensive parts, and put together an adapter that will upgrade your ST to the proper MIDI standard.


The Adapter

MIDI-thru provides a way to play one synth from another without disconnecting your ST. Let's say you have a synth with a keyboard and also one without--maybe one of the popular Yamaha TX7 modules, or the FB-01. You've laid down some hot rhythm section parts using your favorite sequencer software and your keyboard connected, via MIDI cables, to your ST.

You want to try out some lead lines, but you think they'll sound better on your synth with no keyboard. With MIDI-thru, all you have to do is connect a MIDI cable from the MIDI-thru port on your ST to your keyboard-less synth, set the sequencer to playback, and play your lead lines on your CZ. The signal will go straight from the keyboard to the keyboard-less synth while your rhythm parts are being played back on your keyboard.

Of course you can accomplish the same things with the right combination of cables and splitter boxes, but MIDI-thru is a convenient and inexpensive way to handle quite a number of situations. With this adapter, you can add something new to your MIDI bag of tricks.

This is a very simple project, but if you have no experience with hardware you will need more instructions than I have space to provide here. There are a number of books and magazines covering the basics of putting together circuits; if you want one of these adapters and don't want to go to the trouble to make it yourself, I'm sure you can find a TV, stereo, or musical instrument service center to make it for you at a reasonable cost.


midiinout2.jpg
Figure 2

You'll need very few parts to make this adapter: one male 5-pin DIN connector, two female 5-pin DIN connectors, and some short connecting wires (Figure 2).It would probably be best if you used shielded cable for connections, but I used plain wire and haven't had any trouble. The secret is to keep the wires short to minimize the possibility of interference. If you can find them, get DIN connectors with solder lugs and your work will be easier. You should find a little number near the solder connection for each pin on your sockets. That number is the pin number and corresponds to the numbers you will see in Figure 2. Make sure you connect the correct wire to the pin and there are no solder connections or pieces of wire between the pins.

You need to solder six wires to the 5-pin male DIN connector--the middle pin (#2) needs two wires. If you are going to be fancy and use shielded cable, the shields for the two cable sections should both be attached to this pin in place of two wires.

After that it's just a matter of soldering the correct wire to the correct pin on the female 5-pin DIN sockets. Pin 2 (ground) on the male socket has to be connected to pin 2 on both of the female sockets, either through a short length of wire or through the shield on your shielded cable if you are using shielded cable. Pins 1 and 3 of the male socket have to be connected to pins 4 and 5 of one of the female sockets (this will be your MIDI-thru port), and pins 4 and 5 from the male socket have to be connected to pins 4 and 5 of the other female socket (for normal MIDI Out operation.)

Make sure you get all the wires connected correctly, and make sure no wires can short out against each other at the 5-pin DIN connectors. I tend to use pieces of electrical tape for extra insulation if it looks as if anything might ever be a problem; think about what a few years of abuse might do to loosen things up.

Now, put the sockets themselves back together, and plug the male socket into the MIDI Out port on your ST. The female socket connected to pins 1 and 3 of the male socket should now function as a proper MIDI-thru port, and the female socket wired to pins 4 and 5 of the male socket is now a correct MIDI Out port. Be sure to label the two female sockets so you know which is which without tearing the whole thing apart!

With the addition of a MIDI-thru adapter, the ST's MIDI hardware is complete. A built-in external clock sync would be nice, but we can't have everything, and that's not actually a part of the MIDI specification.


And There You Have It

Confused? Good, join everyone else who has dealt with MIDI. The point is, at least some things are very simple to do, and the others will become easier as you absorb more information. The MIDI specification is a powerful tool and, while it has limitations, accomplishes a great deal. The more I work with MIDI the more respect I have for its originators.

If you want to do anything serious with MIDI, get the MIDI 1.0 Detailed Specification(version 4.1) from the International MIDI Association (see START Bookshelf).

Several magazines offer strong coverage of MIDI. The most important is Keyboard Magazine,which publishes columns about MIDI constantly, often by the people who wrote the specification in the first place. Another magazine to look for is Electronic Musician.There is also an online service called PAN, which specializes in the arts. Their office number is (215) 584-0300. Of course, each of the major online services such as CompuServe, GEnie and Delphi, include special MIDI sections.

Tom Jeffries is a professional musician turned programmer who lives in Oakland, Calif.


 START DICTIONARY


Cycle: One complete occurrence of a waveform, from start to finish (see Waveform).

DIN plug: The round connector at either end of a MIDI cable.

Envelope: The overall configuration of a waveform. If you draw a line around one entire cycle of a waveform, this constitutes a sound envelope. See Waveform, Cycle.

Frequency: How often a sound (from either an acoustical or electronic musical instrument) vibrates in one second. The higher the frequency, the higher the pitch.

Filter: A device that eliminates certain frequencies from an audio signal. A high-pass filter eliminates low frequency sound. Conversely, a low-pass filter eliminates high frequency sound. The point at which elimination starts is called the cut-off frequency.

MIDI: Musical Instrument Digital Interface. In 1982 several major musical equipment manufacturers decided upon a set standard, MIDI, for the transferal of sound data from one electronic instrument to another. All MIDI-equipped devices speak the same language and can "talk," or exchange data, with one another.

NAMM: An acronym for National Association of Music Merchants, a trade group of retailers and wholesalers who market music-related products.

Note-off: The point at which a key is released. The speed of the key rising is called the note-off velocity.

Note-on: The point at which a key is hit. Note-on velocity is how fast and with what force you are hitting a key.

Patch: A piece of music created on and played by a synthesizer.

Patch Editor: Software enabling you to alter a sound's specific values such as pitch, volume and frequency. The patch editor also allows you to save patches on disk and transfer patches into a synthesizer.

Sample: A section of digitally recorded sound. Turning an audio signal into digital (computer-readable) sound is called sampling.

Sequencer: A device that stores a series of notes for later playback on other instruments.

SMPTE: An acronym for Society of Motion Picture and Television Engineers. Also used to describe a timing code which allows the various parts of a production (film, tape, sound, special effects) to be synchronized.

Sustain: The continuation of a note or sound after the key is released.

System exclusive message: A MIDI message directed only to devices that can use its specialized data.

Waveform: The changes in air pressure over time, displayed graphically as a line, as a sound is created. In MIDI, the waveform is the changes in voltage over time. If a waveform completes one cycle and returns to its starting configuration, it is called a periodic waveform. See Cycle.

Wavelength: The distance between the consecutive peaks of a waveform. See Cycle.


 START BOOKSHELF


COMPILED BY AMY H. JOHNSON, START ASSOCIATE EDITOR


C Programming for MIDI, Jim Conger, M&T Books, $22.95. Fairly technical reference; better know your C. Optional IBM disk. M&T's order number is 1-800-533-4772 outside California; 1-800-356-2002 inside California.

MIDI and Sound Book for the Atari ST, Bernd Enders and Wolfgang Klemme, M&T Books, $17.95. More about digitized sound and the ST's internal sound chip than MIDI in particular. Optional Atari disk.

MIDI for Musicians, Craig Anderton, Amsco Publications, $14.95. A little dated, but an excellent introduction by an authority in the MIDI field.

MIDI Programmer's Handbook, Steve De Furia and Joe Scacciaferro, M&T Books, $24.95. Begins by dissecting a MIDI instrument and ends with a generic application written in Pascal. Optional Atari disk.

MIDI Sequencing in C, Jim Conger, M&T Books, $24.95. Analyzes an eight-track sequencer, whose C code is scattered throughout the book. Optional IBM disk.

MIDI 1.0 Detailed Specification version 4.1, International MIDI Association, price unknown. An absolute must. Write to 5316 W. 57th St., Los Angeles, CA 90056 (213) 649-6434.

Music Through MIDI, Michael Boom, Microsoft Press, $19.95. Wide focus. Discusses MIDI/music from bass clefs to brand names, MIDIphiles from home to Hollywood. Jim Pierson-Perry says it's the single best reference.

An excellent source for more specialized books is the MLX Bookshelf. Call 1-800-233-9604 and ask for a catalog.