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.
Numbers followed by an "H" are in hexadecimal.
All other numbers are in decimal.
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.
(HP 6N138 or other optoisolator can be used with appropriate changes)
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.
System messages are not encoded with channel numbers.
There are three types of System messages: Common, Real-Time, and Exclusive.
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.
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.
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.
STATUS # OF DATA DESCRIPTION D7---D0 BYTES <strong>Channel Voice Messages</strong> 1000nnnn 2 Note Off event 1001nnnn 2 Note On event (velocity=0: Note Off) 1010nnnn 2 Polyphonic key pressure/after touch 1011nnnn 2 Control change 1100nnnn 1 Program change 1101nnnn 1 Channel pressure/after touch 1110nnnn 2 Pitch bend change <strong>Channel Mode Messages</strong> 1011nnnn 2 Selects Channel Mode <strong>System Messages</strong> 11110000 ***** System Exclusive 11110sss 0 to 2 System Common 11111ttt 0 System Real TimeNotes:
nnnn: N-1, where N = Channel #, i.e. 0000 is Channel 1. 0001 is Channel 2. . . . 1111 is Channel 16. *****: 0iiiiiii, data, ..., EOX iiiiiii: Identification sss: 1 to 7 ttt: 0 to 7
STATUS DATA BYTES DESCRIPTION 1000nnnn 0kkkkkkk Note Off (see notes 1-4) 0vvvvvvv vvvvvvv: note off velocity 1001nnnn 0kkkkkkk Note On (see notes 1-4) 0vvvvvvv vvvvvvv - 0: velocity vvvvvvv = 0: note off 1010nnnn 0kkkkkkk Polyphonic Key Pressure (After-Touch) 0vvvvvvv vvvvvvv: pressure value 1011nnnn 0ccccccc Control Change 0vvvvvvv ccccccc: control # (0-121) (see notes 5-8) vvvvvvv: control value ccccccc = 122 thru 127: Reserved. (See Table III) 1100nnnn 0ppppppp Program Change ppppppp: program number (0-127) 1101nnnn 0vvvvvvv Channel Pressure (After-Touch) vvvvvvv: pressure value 1110nnnn 0vvvvvvv Pitch Bend Change LSB (see note 10) 0vvvvvvv Pitch Bend Change MSBNotes:
0 12 24 36 48 60 72 84 96 108 120 127 ----------------------------------------------------------------- ac c c c c c c c |-------------- piano range -------------------|
0 1 64 127 ------------------------------------------------------------------- off ppp pp mp mf f ff fff vvvvvvv = 64: in case of no velocity sensors vvvvvvv = 0: Note Off, with velocity = 64
ccccccc Description 0 Continuous Controller 0 MSB 1 Continuous Controller 1 MSB (MODULATION BENDER) 2 Continuous Controller 2 MSB 3 Continuous Controller 3 MSB 4-31 Continuous Controllers 4-31 MSB 32 Continuous Controller 0 LSB 33 Continuous Controller 1 LSB (MODULATION BENDER) 34 Continuous Controller 2 LSB 35 Continuous Controller 3 LSB 36-63 Continuous Controllers 4-31 LSB 64-95 Switches (On/Off) 96-121 Undefined 122-127 Reserved for Channel Mode messages (see Table III).
(for controllers) 0 127 |-----------------------------------------------------------------| min max (for switches) 0 127 | - - - - - - - - - - - | off on Numbers 1 through 126, inclusive, are ignored.
STATUS DATA BYTES DESCRIPTION 1011nnnn 0ccccccc Mode Messages 0vvvvvvv ccccccc = 122: Local Control vvvvvvv = 0, Local Control Off vvvvvvv = 127, Local Control On ccccccc = 123: All Notes Off vvvvvvv = 0 ccccccc = 124: Omni Mode Off (All Notes Off) vvvvvvv = 0 ccccccc = 125: Omni Mode On (All Notes Off) vvvvvvv = 0 ccccccc = 126: Mono Mode On (Poly Mode Off) (All Notes Off) vvvvvvv = M, where M is the number of channels. vvvvvvv = 0, the number of channels equals the number of voices in the receiver. ccccccc = 127: Poly Mode On (Mono Mode Off) vvvvvvv = 0 (All Notes Off)Notes:
STATUS DATA BYTES DESCRIPTION 11110001 Undefined 11110010 Song Position Pointer 0lllllll lllllll: (Least significant) 0hhhhhhh hhhhhhh: (Most significant) 11110011 0sssssss Song Select sssssss: Song # 11110100 Undefined 11110101 Undefined 11110110 none Tune Request 11110111 none EOX: "End of System Exclusive" flag
STATUS DATA BYTES DESCRIPTION 11111000 Timing Clock 11111001 Undefined 11111010 Start 11111011 Continue 11111100 Stop 11111101 Undefined 11111110 Active Sensing 11111111 System ResetNotes:
The system is synchronized with this clock, which is sent at a rate of 24 clocks/quarter note.
This byte is immediately sent when the PLAY switch on the master (e.g. sequencer or rhythm unit) is pressed.
This is sent when the CONTINUE switch is hit. A sequence will continue at the time of the next clock.
This byte is immediately sent when the STOP switch is hit. It will stop the sequence.
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.
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:
// 1 - VCC 9 - VCC // 2 - Button (A) 10 - Button (B) // 3 - X coord (A) 11 - X coord (B) // 4 - GND 12 - Midi TXD (s.card game port) // 5 - GND 13 - Y coord (B) // 6 - Y coord (A) 14 - Button (B) // 7 - Button (A) 15 - Midi RXD (soundcard) // 8 - n/c (vcc? some cards) // // REF: 15 PIN GameconnectorMIDI INPUT
Pin 15(RXD) of 'DB15' connector <--------------+ 220 ohm | Pin 9(VCC) of 'DB15' connector <--+--/\/\/\/--+ | | Pin 5(GND) of 'DB15' connector <--------+ | | | | | 6 |5 |4 +---------------+ | PC900 | | or | | HP 6N138 | +---------------+ |1 |2 |3 \ | | 220 ohm / | +-----> No connection \ | / +-----> Pin 5 of DIN connector | +-----------> Pin 4 of DIN connectorMIDI OUTPUT
220 ohm Pin 9(VCC) of 'DB15' connector <---------/\/\/\/\/---------> To pin 4 of DIN con. Pin 12(TXD) of 'DB15' connector <---------------------------> To pin 5 of DIN con. Pin 5(GND) of 'DB15' (Screen) <---------------------------> To pin 2 of DIN con.