Introduction into MIDI

HOW MUCH FOR JUST THE MIDI?
By Eric Lipscomb (BITNET: LIPS@UNTVAX).

<!-- saved from url=
http://harmony-central.com/MIDI/Doc/intro.html
-->
<!-- alt saved from url=
http://www.music.vt.edu/technology/Intromidi/intromidi.html
-->

This article appeared in the October 1989 issue of North Texas Computing
Center Newsletter, "Benchmarks".

[*** Edited 10/95]

Computer retailers are hearing about it. Music store sales people are
buying and selling it. Musicians and students are talking about it.

Professional writers are publishing articles about it. Entire magazines
are devoted to it. Students at the Massachusetts Institute of Technology
are receiving large grants to research it. Joe "Keys" Manzotti uses it
when he plays with his band at the Holiday Inn on weekends. Just what IS
this MIDI thing anyway?

MIDI stands for Musical Instrument Digital Interface and has been the
rage among electronic musicians throughout its six year existence. It is
a powerful tool for composers and teachers alike. It allows musicians to
be more creative on stage and in the studio. It allows composers to
write music that no human could ever perform. But it is NOT a tangible
object, a thing to be had. MIDI is a communications protocol that allows
electronic musical instruments to interact with each other.

A Method, Not An Object

All too often I have seen misinformed customers browsing through a music
store: "Where do you keep your MIDIs?" "I'd like to get a MIDI for my
home computer."

"I need to get two MIDIs so they can talk to each other, right?"
Explaining to customers that they cannot just get a MIDI becomes
frustrating to the salesman.

Fortunately, the average consumer is learning more about the concept of
MIDI through articles such as this one. To have a complete understanding
of how MIDI works, though, one should learn its history.

The Saga of MIDI

The combined advances and cost-efficiency in synthesizer technology
caught the music world by storm. At times, a musician could not get a
new synthesizer home before it had been outdated by a new product. One
major factor in the increased popularity in synthesizers, and the
increased push for research and design of these units, was the
development of new sound generation methods. Musicians were creating new
and different sounds worldwide. Eventually, the musical world began to
recognize the synthesizer as a legitimate musical instrument.

Musicians were physically limited, though, because they had only two
hands. Popular and avant-garde performers alike desired to "layer" their
new sound creations, to play two sounds together to create a "larger"
sound. Though this was possible to some extent in a multi-track
recording studio, layering could not be realized on the road. A few
synthesizer design technicians from different manufacturers then got
together to discuss an idea they shared. Surely, they said, there had to
be a way to play one keyboard and have another one sound simultaneously.
They jotted a few notes, considered a few options, and scuttled back to
their design labs to create this communication method.

They revealed their results at the first North American Music
Manufacturers show in Los Angeles in 1983. The simple demonstration
connected two synthesizers, not manufactured by the same company, with
two cables. A representative from one company then played one of the
synthesizers while an amazed audience heard both sound. The process was
then reversed to demonstrate the two-way nature of the communication.
Other variations were illustrated, and the rest is music history.

The Method of MIDI

Much in the same way that two computers communicate via modems, two
synthesizers communicate via MIDI. The information exchanged between two
MIDI devices is musical in nature. MIDI information tells a synthesizer,
in its most basic mode, when to start and stop playing a specific note.
Other information shared includes the volume and modulation of the note,
if any. MIDI information can also be more hardware specific. It can tell
a synthesizer to change sounds, master volume, modulation devices, and
even how to receive information. In more advanced uses, MIDI information
can to indicate the starting and stopping points of a song or the metric
position within a song. More recent applications include using the
interface between computers and synthesizers to edit and store sound
information for the synthesizer on the computer.

The basis for MIDI communication is the byte. Through a combination of
bytes a vast amount of information can be transferred. Each MIDI command
has a specific byte sequence. The first byte is the status byte, which
tells the MIDI device what function to perform. Encoded in the status
byte is the MIDI channel. MIDI operates on 16 different channels,
numbered 0 through 15. MIDI units will accept or ignore a status byte
depending on what channel the machine is set to receive. Only the status
byte has the MIDI channel number encoded. All other bytes are assumed to
be on the channel indicated by the status byte until another status byte
is received.

Some of these functions indicated in the status byte are Note On, Note
Off, System Exclusive (SysEx), Patch Change, and so on. Depending on the
status byte, a number of different byte patterns will follow. The Note
On status byte tells the MIDI device to begin sounding a note. Two
additional bytes are required, a pitch byte, which tells the MIDI device
which note to play, and a velocity byte, which tells the device how loud
to play the note. Even though not all MIDI devices recognize the
velocity byte, it is still required to complete the Note

On transmission.

The command to stop playing a note is not part of the Note On command;
instead there is a separate Note Off command. This command also requires
two additional bytes with the same functions as the Note On byte. Most
people are confused at first by this approach to Note On and Note Off,
but after further thought they realize the necessity of the structure.

Another important status byte is the Patch Change byte. This requires
only one additional byte: the number corresponding to the program number
on the synthesizer. The patch number information is different for each
synthesizer, and the standards have been set by the MIDI Manufacturers
Association (MMA). Channel selection is extremely helpful when sending
Patch Change commands to a synthesizer.

The SysEx status byte is the most powerful and least understood of all
the status bytes because it can instigate a variety of functions.
Briefly, the SysEx byte requires at least three additional bytes. The
first is a manufacturer's ID number or timing byte, the second is a data
format or function byte, and the third is generally an "end of
transmission" (EOX) byte. There are a number of books that have been
written on the topic of System Exclusive messages, so this article will
not deal with it further.

The INs and OUTs of MIDI

The closest most people ever care to get to the heart of the MIDI
interface are the three 5-pin ports found on the back of every MIDI
unit. Labeled IN, OUT, and THRU, these ports control all of the
information routing in a MIDI system. The IN port accepts MIDI data,
data coming "in" to the unit from an external source.

This is the data that controls the sound generators of the synthesizer.
The OUT port sends MIDI data "out" to the rest of the MIDI setup. This
data results from activity of the synthesizer, such as key presses,
patch changes, and so on. The THRU port also sends data out to the MIDI
system, but not in the same manner as the OUT port. The data coming from
the THRU port is an exact copy of the data received at the synthesizer's
IN port. There is no change made to the data from the time it arrives at
the IN port to the time is leaves the THRU port (which is a very, VERY
small amount of time).

MIDI makes use of special five conductor cable to connect the
synthesizer ports. 

Curiously though, only three of the conductors are actually used. Data
is carried through the cable on pins 1 and 3, and pin 2 is shielded and
connected to common. Pins 4 and 5 remain unused. Not just any cable will
suffice for the exactness of the MIDI system, either. MIDI cable is
specially grounded and shielded to ensure efficient data transmission.
This means that MIDI cable is a little more expensive than standard
5-conductor cable, but reliable data transmission is absolutely
necessary for MIDI.

The length of the cable is critical as well. MMA specifications suggest
an absolute maximum cable length of 50 feet because of the method of
data transmission through the cable. The entire length of a MIDI chain
(discussed below) is unlimited, however, provided that none of the links
are longer than 50 feet. The optimal maximum length for cable is about
20 feet, and most commercially manufactured cable comes in five to ten
foot lengths.

MIDI Chains and Loops

A MIDI chain describes a series of one-way connections in a MIDI setup.
The elemental chain is a single-link chain. The MIDI OUT port of one
device is connected to the MIDI IN port of a second. In this
configuration, a key pressed on the first unit will cause both units to
sound. Pressing a key on the second unit, however, only causes the
second unit to sound. Many instruments may be chained together using a
series of single links to connect the units. In this case, the OUT of
the first unit is connected to the second, the THRU of the second is
connected to the IN of a third, and so on. If all the units are set to
receive on the same channel, pressing a key on the first one will cause
all the units to sound. Pressing a key on any of the other units will
only activate the sound of that unit.

A MIDI loop is a special configuration of a MIDI chain. The single
element loop is made of two interconnecting links. This was the
configuration used in the debut of the MIDI system. The OUT port of the
first unit is connected to the IN port of the second, and the OUT port
of the second is connected to the IN port of the first. In this case, as
described earlier, a key pressed on either unit causes both units to
sound, provided they are on the same channel. A MIDI feedback loop does
NOT exist here, as the data going into the second unit from the first is
not duplicated in the OUT port of the second going back into the first.
Here, we have two one-way links connected, not a multi-link chain.

MIDI loops connecting several devices using all three ports can become
complex very quickly. As a brief example, imagine four synthesizers
named A, B, C, and D for convenience. A's OUT is connected to B's IN and
consequently to C's IN via B's THRU. B's OUT connects to D's IN, whose
THRU connects to A's IN. A key pressed on A sounds A, B and C. A key
pressed on C sounds C and C alone. A key pressed on B sounds B, D, and
A, while a key pressed on D sounds D only. C does not sound when B is
pressed because there is no direct connection between B and C, and B's
note, which does route through D, does not route through A into C
because A's THRU is not connected to C, or anything else for that
matter. A note played on A does not sound on D for the same reason. You
get the idea.

Computers and MIDI

Computer manufacturers soon realized that the computer would be a
fantastic tool for MIDI, since MIDI devices and computers speak the same
language. Since the MIDI data transmission rate (31.5 kBaud) is
different from ANY computer data rate, manufacturers had to design a
MIDI interface to allow the computer to talk at MIDI's speed. Apple
Computers, with the Macintosh and Apple ][ series, and Commodore were
the first companies to jump on the MIDI computer bandwagon [pun
intended]. Roland designed an interface for the IBM series of compatible
computers a few years later, and Atari designed a completely new
computer, the ST series, with fully operable MIDI ports built in. Today,
there are many different interfaces available for almost all types of
computer system.

As great as the number of available interfaces may be, the availability
of software packages is almost beyond belief. Virtually everything that
can be done via MIDI has a software package to do it. First came the
sequencers. Based on a hardware device that simply recorded and replayed
MIDI data, the software sequencer allowed the computer to record, store,
replay, and edit MIDI data into "songs." Though the first sequencers
were somewhat primitive, the packages available today provide very
thorough editing capabilities as well as intricate synchronization
methods, such as MTC (MIDI Time Code) and SMPTE.

Various patch editors and librarians are also available for computers.
These programs allow the user to edit sounds away from the synthesizer
and often in a much friendlier environment than what the synthesizer
interface offers. The more advanced librarians permit groups or banks of
sounds to be edited, stored on disk, or moved back and forth from the
synthesizer's memory. They also allow for rearranging sounds within
banks or groups of banks for customized libraries.

These programs are generally small and can be incorporated into some
sequencing packages for ease of use. On the other hand, each synthesizer
requires a different editor/librarian since internal data formats are
unique for each. Some packages offer editor groups for a specific
manufacturer's line as some of the internal data structure may be
similar between the units. But, there is not yet a universal librarian
that covers all makes and models of sound modules; it would just be too
large.

Computers in MIDI Chains

Basically, the computer functions the same as any other unit in a MIDI
chain or loop. Most interfaces have the same three ports as other MIDI
devices. The computer's main job in a chain, though, would be as a MIDI
data driver, meaning it would supply the MIDI data for the rest of the
chain. Very rarely is a device connected to the IN port of a computer
MIDI interface except to provide input for synchronization signals or
data to edit. Even more rare is a connection to the computer's THRU
port, although it can be used.

In this scope the implementation of MIDI channels is most effective. The
computer can send data out on all 16 MIDI channels simultaneously. For
example, sixteen MIDI devices, each set up for a different MIDI channel,
could be connected to the computer. Each unit could be playing a
separate line in a song from the sequencer, creating an electronic
orchestra. This implementation is being used more and more in today's
music scenes: the recording studio, major orchestras, opera, and film
scoring.

References

Arnell, Billy. "McScope: System." Music, Computers, and Software, April
1988: 58-60.

Conger, Jim. C Programming for MIDI. Redwood City: M & T Books, 1988.

Cooper, Jim. "Mind Over MIDI: Information Sources and System-exclusive
Data Formats." Keyboard October, 1986: 110-111.

Enders, Bernd and Wolfgang Klemme. MIDI and Sound Book for the Atari ST.
Redwood City: M & T Books, 1989.

Matzkin, Jonathan. "A MIDI Musical Offering." PC Magazine 29 Nov. 1988:
229+.

Peters, Constantine. "Reading up on MIDI for the Novice and the Pro." PC
Magazine 29 Nov. 1988: 258.

ABOUT THE AUTHOR: Eric Lipscomb is a Vice President of the International
Electronic Musicians User's Group, an organization devoted to the
advancement of knowledge about MIDI and other aspects of electronic
music. In his spare time he writes for and performs with the comedy
group "Green Chili Burp and the Aftertaste."

[*** Edited 1995 - References to the International MIDI Association
(IMA) have been changed to MIDI Manufacturers Association (MMA), which
is now the official source of the MIDI Specification. The original
article also has a section on the Future of MIDI which has been removed
from this document. The comments made were considered inappropriate
given the date of authorship.]

CCNEWS Copyright Notice

If you use this article, in whole or in part, in printed or electronic
form, you are legally and morally obligated to credit the author and the
original publication name, date, and page(s).

If space and format permit, we would appreciate your crediting the
"Articles database of CCNEWS, the Electronic Forum for Campus Computing
Newsletter Editors, a BITNET-based service of EDUCOM."
