MIDI enables synthesizers, sequencers, home computers, rhythm machines, etc.
to be interconnected through a standard interface.

Each MIDI-equipped instrument usually contains a receiver and a transmitter.
Some instruments may contain only a receiver or transmitter. The receiver
receives messages in MIDI format and executes MIDI commands. It consists of an
optoisolator, Universal Asynchronous Receiver/Transmitter (UART), and other
hardware needed to perform the intended functions. The transmitter originates
messages in MIDI format, and transmits them by way of a UART and line driver.

The MIDI standard hardware and data format are defined in this specification.

NOTE:

Call IMA and order your copy of this specification, which offers additional
information NOT contained in this file, to include important diagrams and
graphs,...etc.

The interface operates at 31.25 (+/- 1%) Kbaud, asynchronous, with a start
bit, 8 data bits (D0 to D7), and a stop bit. This makes a total of 10 bits for
a period of 320 microseconds per serial byte.

Circuit: 5 mA current loop type. Logical 0 is current ON. One output shall
drive one and only one input. The receiver shall be opto-isolated and require
less than 5 mA to turn on. Sharp PC-900 and HP 6N138 optoisolators have been
found acceptable. Other high-speed optoisolators may be satisfactory. Rise
and fall times should be less than 2 microseconds.

Connectors: DIN 5 pin (180 degree) female panel mount receptacle. An example
is the SWITCHCRAFT 57 GB5F. The connectors shall be labelled "MIDI IN" and
"MIDI OUT". Note that pins 1 and 3 are not used, and should be left
unconnected in the receiver and transmitter.

Notes:

Optoisolator is Sharp PC-900.

(HP 6N138 or other optoisolator can be used with appropriate changes)

Gates "A" are IC or transistor.

Resistors are 5%

Cables shall have a maximum length of fifty feet (15 meters), and shall be
terminated on each end by a corresponding 5-pin DIN male plug, such as the
SWITCHCRAFT 05GM5M. The cable shall be shielded twisted pair, with the shield
connected to pin 2 at both ends.

A "MIDI THRU" output may be provided if needed, which provides a direct copy
of data coming in MIDI IN. For very long chain lengths (more than three
instruments), higher-speed optoisolators must be used to avoid additive
rise/fall time errors which affect pulse width duty cycle.

Channel messages contain a four-bit number in the Status byte which address
the message specifically to one of sixteen channels. These messages are
thereby intended for any units in a system whose channel number matches the
channel number encoded into the Status byte.

There are two types of Channel messages: Voice and Mode.

Voice

To control the instrument's voices, Voice messages are
sent over the Voice Channels.

Mode

To define the instrument's response to Voice messages,
Mode messages are sent over the instument's Basic Channel.

System

System messages are not encoded with channel numbers.

There are three types of System messages: Common, Real-Time, and Exclusive.

Common

Common messages are intended for all units in a system.

Real-Time

Real-Time messages are intended for all units in a system.
They contain Status bytes only -- no Data bytes. Real-Time
messages may be sent at any time -- even between bytes of a
message which has a different status. In such cases the
Real-Time message is either ignored or acted upon, after which
the receiving process resumes under the previous status.

Exclusive

Exclusive messages can contain any number of Data bytes, and
are terminated by an End of Exclusive (EOX) or any other Status
byte. These messages include a Manufacturer's Identification
(ID) code. If the receiver does not recognize the ID code, it
should ignore the ensuing data.

So that other users can fully access MIDI instruments, manufacturers
should publish the format of data following their ID code. Only the
manufacturer can update the format following their ID.

Status bytes are eight-bit binary numbers in which the Most Significant Bit
(MSB) is set (binary 1). Status bytes serve to identify the message type, that
is, the purpose of the Data bytes which follow the Status byte.

Except for Real-Time messages, new Status bytes will always command the
receiver to adopt their status, even if the new Status is received before the
last message was completed.

Running Status

For Voice and Mode messages only, when a Status byte is
received and processed, the receiver will remain in that status
until a different Status byte is received. Therefore, if the same
Status byte would be repeated, it may (optionally) be omitted so
that only the correct number of Data bytes need be sent. Under
Running Status, then, a complete message need only consist of
specified Data bytes sent in the specified order.

The Running Status feature is especially useful for
communicating long strings of Note On/Off messages, where
"Note On with Velocity of 0" is used for Note Off. (A separate
Note Off Status byte is also available.)

Running Status will be stopped when any other Status byte
intervenes, except that Real-Time messges will only interrupt
the Running Status temporarily.

Unimplemented Status

Any status bytes received for functions which the receiver has not
implemented should be ignored, and subsequent data bytes ignored.

Undefined Status

Undefined Status bytes must not be used. Care should be taken to
prevent illegal messages from being sent during power-up or
power-down. If undefined Status bytes are received, they
should be ignored, as should subsequent Data bytes.

Data Bytes

Following the Status byte, there are (except for Real-Time messages) one or
two Data bytes which carry the content of the message. Data bytes are
eight-bit binary numbers in which the MSB is reset (binary 0). The number and
range of Data bytes which must follow each Status byte are specified in the
tables which follow. For each Status byte the correct number of Data bytes
must always be sent. Inside the receiver, action on the message should wait
until all Data bytes required under the current status are received. Receivers
should ignore Data bytes which have not been properly preceeded by a valid
Status byte (with the exception of "Running Status," above).

Synthesizers contain sound generation elements called voices. Voice
assignment is the algorithmic process of routing Note On/Off data from the
keyboard to the voices so that the musical notes are correctly played with
accurate timing.

When MIDI is implemented, the relationship between the sixteen available MIDI
channels and the synthesizer's voice assignment must be defined. Several Mode
messages are available for this purpose (see Table III). They are Omni
(On/Off), Poly, and Mono. Poly and Mono are mutually exclusive, i.e., Poly
Select disables Mono, and vice versa. Omni, when on, enables the receiver to
receive Voice messages in all voice Channels without discrimination. When Omni
is off, the receiver will accept Voice messages from only the selected Voice
Channel(s). Mono, when on, restricts the assignment of Voices to just one
voice per Voice Channel (Monophonic.) When Mono is off (=Poly On), any number
of voices may be allocated by the Receiver's normal voice assignment algorithm
(Polyphonic.)

For a receiver assigned to Basic Channel "N," the four possible modes arising
from the two Mode messages are:

Mode Omni
1 On Poly Voice messages are received from
all Voice channels and assigned to
voices polyphonically.
2 On Mono Voice messages are received from
all Voice Channels, and control
only one voice, monophonically.
3 Off Poly Voice messages are received in Voice
channel N only, and are assigned to
voices polyphonically.
4 Off Mono Voice messages are received in Voice
channels N thru N+M-1, and assigned
monophonically to voices 1 thru M,
respectively. The number of voices M
is specified by the third byte of the
Mono Mode Message.

Four modes are applied to transmitters (also assigned to Basic Channel N).
Transmitters with no channel selection capability will normally transmit on
Basic Channel 1 (N=0).

Mode Omni
1 On Poly All voice messages are transmitted in
Channel N.
2 On Mono Voice messages for one voice are sent
in Channel N.
3 Off Poly Voice messages for all voices are sent
in Channel N.
4 Off Mono Voice messages for voices 1 thru M are
transmitted in Voice Channels N thru N+M-1,
respectively. (Single voice per channel).

A MIDI receiver or transmitter can operate under one and only one mode at a
time. Usually the receiver and transmitter will be in the same mode. If a
mode cannot be honored by the receiver, it may ignore the message (and any
subsequent data bytes), or it may switch to an alternate mode (usually Mode 1,
Omni On/Poly).

Mode messages will be recognized by a receiver only when sent in the Basic
Channel to which the receiver has been assigned, regardless of the current
mode. Voice messages may be received in the Basic Channel and in other
channels (which are all called Voice Channels), which are related specifically
to the Basic channel by the rules above, depending on which mode has been
selected.

A MIDI receiver may be assigned to one or more Basic Channels by default or by
user control. For example, an eight-voice synthesizer might be assigned to
Basic Channel 1 on power-up. The user could then switch the instrument to be
configured as two four-voice synthesizers, each assigned to its own Basic
Channel. Separate Mode messages would then be sent to each four-voice
synthesizer, just as if they were physically separate instruments.

All controllers are specifically defined by agreement of the MIDI
Manufacturers Association (MMA) and the Japan MIDI Standards Committee (JMSC).
Manufacturers can request throught the MMA or JMSC that logical controllers be
assigned to physical ones as necessary. The controller allocation table must
be provided in the user's operation manual.

Continuous controllers are divided into Most Significant and Least
Significant Bytes. If only seven bits of resolution are needed for any
particular controllers, only the MSB is sent. It is not necessary to send the
LSB. If more resolution is needed, then both are sent, first the MSB, then the
LSB. If only the LSB has changed in value, the LSB may be sent without
re-sending the MSB.

Messages 123 thru 127 function as All Notes Off messages. They will turn
off all voices controlled by the assigned Basic Channel. Except for message
123, All Notes Off, they should not be sent periodically, but only for a
specific purpose. In no case should they be used in lieu of Note Off commands
to turn off notes which have been previously turned on. Therefore any All
Notes Off command (123-127) may be ignored by receiver with no possibility of
notes staying on, since any Note On command must have a corresonding specific
Note Off command.

Control Change #122, Local Control, is optionally used to interrupt the
internal control path between the keyboard, for example, and the
sound-generating circuitry. If 0 (Local Off mesage) is received, the path is
disconnected: the keyboard data goes only to MIDI and the sound-generating
circuitry is controlled only by incoming MIDI data. If a 7FH (Local On
message) is received, normal operation is restored.

The third byte of "Mono" specifies the number of channels in which
Monophonic Voice messages are to be sent. This number, "M", is a number
between 1 and 16. The channel(s) being used, then, will be the current Basic
Channel (=N) thru N+M-1 up to a maximum of 16. If M=0, this is a special case
directing the receiver to assign all its voices, one per channel, from the
Basic Channel N through 16.

Is an internal register which holds the number of
MIDI beats (1 beat = 6 MIDI clocks) since the start of the song. Normally it
is set to 0 when the START switch is pressed, which starts sequence playback.
It then increments with every sixth MIDI clock receipt, until STOP is pressed.
If CONTINUE is pressed, it continues to increment. It can be arbitrarily
preset (to a resolution of 1 beat) by the SONG POSITION POINTER message.

Song Select

Specifies which song or sequence is to be played upon receipt of a Start
(Real-Time) message.

Tune Request

Used with analog synthesizers to request them to tune their oscillators.

EOX

Used as a flag to indicate the end of a System Exclusive transmission
(see Table VI).

The System Real Time messages are for synchronizing all of the system in real time.

The System Real Time messages can be sent at any time. Any messages which
consist of two or more bytes may be split to insert Real Time messages.

Timing clock (F8H)

The system is synchronized with this clock, which is sent at a rate of 24
clocks/quarter note.

Start (from the beginning of song) (FAH)

This byte is immediately sent when the PLAY switch on the master (e.g.
sequencer or rhythm unit) is pressed.

Continue (FBH)

This is sent when the CONTINUE switch is hit. A sequence will continue at the
time of the next clock.

Stop (FCH)

This byte is immediately sent when the STOP switch is hit. It will stop the
sequence.

Active Sensing (FEH)

Use of this message is optional, for either receivers or transmitters. This
is a "dummy" Status byte that is sent every 300 ms (max), whenever there is no
other activity on MIDI. The receiver will operate normally if it never
receives FEH. Otherwise, if FEH is ever received, the receiver will expect to
receive FEH or a transmission of any type every 300 ms (max). If a period of
300 ms passes with no activity, the receiver will turn off the voices and
return to normal operation.

System Reset (FFH)

This message initializes all of the system to the condition of just having
turned on power. The system Reset message should be used sparingly, preferably
under manual command only. In particular, it should not be sent automatically
on power up.

STATUS DATA BYTES DESCRIPTION
11110000 Bulk dump etc.
0iiiiiii iiiiiii: identification
.
(0*******)
. Any number of bytes may be sent here, for any
purpose, as long as they all have a zero in the most significant bit.
(0*******)
.
11110111 EOX: "End of System Exclusive"

Notes:

iiiiiii: identification ID (0-127)

All bytes between the System Exclusive Status byte and EOX or the next
Status byte must have zeroes in the MSB.

The ID number can be obtained from the MMA or JMSC.

In no case should other Status or Data bytes (except Real-Time) be
interleaved with System Exclusive, regardless of whether or not the ID code is
recognized.

EOX or any other Status byte, except Real-Time, will terminate a System
Exclusive message, and should be sent immediately at its conclusion.