MIDI 1.0

From HandWiki
Revision as of 09:43, 8 May 2022 by imported>Scavis2 (fixing)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
MIDI ports and cable.

The Musical Instrument Digital Interface (MIDI) specification version 1.0 describes the communications protocol and the message format, as well electrical connector.

MIDI 1.0 is a one-way connection from the MIDI Out connector of the sending device to the MIDI In connector of the receiving device, transmitted serially at a rate of 31.25 kbit/s.

Messages

Each MIDI connection carries a stream of MIDI messages made up of 8-bit bytes. The messages are extremely compact, due to the low bandwidth of the connection and the need for real-time accuracy. Most messages consist of a status byte (channel number in the low 4 bits, for a total of 16 channels, and an opcode in the high 4 bits), followed by one or two data bytes.

The channels are used to control several instruments at once using a single MIDI connection. A multitimbral instrument is capable of producing several independent sounds or "voices" simultaneously on separate MIDI channels.

To further optimize the data stream, "Running status" convention allows the status byte to be omitted if it would be the same as that of the previous message. This is possible since status byte always starts with high bit 1, while all data bytes are encoded as 7-bit values and always start with high bit 0.

MIDI messages can be channel messages sent on only one of the 16 channels and monitored only by devices on that channel, or system messages that all devices can receive.

Channel Voice messages

Channel Voice messages transmit real-time performance data over a single channel. Most messages represent a common musical performance event or gesture such as note-on, note-off, controller value change (including volume, pedal, modulation signals, etc.), pitch bend, program change, aftertouch, channel pressure.

  • Note messages represent notes numbered from 0 to 127) with precision down to the semitone. A note-on message starts a note, and a separate note-off message (or note-on message with the velocity set to zero) is needed to end it.
  • Pitch-bend Wheel messages range in ±2 semitones (adjustable with Registered Parameter Number 0x0000), with precision of 1/8192 semitone.
  • Control Change messages are usually generated using knobs, sliders, footswitches, or pressure on a physical MIDI controller. They are typically used to change the tone, timbre, or volume of an instrument's sound, and change parameters like pitchbend range and musical tuning.
  • Program Change messages recall another patch/program on a particular channel, with additional Bank Select controllers that enable access to 16,384 banks of 128 programs.
  • Aftertouch messages include Polyphonic Pressure to indicate pressure changes on each note while it is being played, or Channel Pressure messages that indicate pressure changes on the entire keyboard instead of individual keys.
MIDI 1.0 Channel Voice messages
Event Status byte Byte 2 Byte 3 Description
Note Off 0x8= 0b1000 Channel
0x0..0xF
Note Number Velocity
Note On 0x9= 0b1001 Note Number Velocity
Polyphonic Key Pressure (Aftertouch) 0xA= 0b1010 Note Number Pressure
Control Change 0xB= 0b1011 Controller Number Value
Program Change 0xC= 0b1100 Program Number Does not appear
Channel Pressure (Aftertouch) 0xD= 0b1101 Pressure Does not appear
Pitch Wheel 0xE= 0b1110 LSB MSB
MIDI 1.0 Controllers[1]
CC#
MSB
CC#
LSB
Name Description
0 32 Bank Select
1 33O Modulation wheel or lever
2O 34O Breath Controller
4 36O Foot Controller
5 37O Portamento Time
6 38 Data Entry
7 39O Channel Volume
8O 40O Balance
10 42O Pan
11 43O Expression
12O 44O Effect Control 1
13O 45O Effect Control 2
16O 48O General Purpose Controller 1
17O 49O General Purpose Controller 2
18O 50O General Purpose Controller 3
19O 51O General Purpose Controller 4
98 99 Non-Registered Parameter Number (NRPN)
100 101 Registered Parameter Number (RPN)
CC# Name Description
64 Damper Pedal (Sustain/Hold) On/Off Value ≤63 Off, ≥64 On
65 Portamento On/Off
66 Sostenuto On/Off
67 Soft Pedal On/Off
68O Legato Footswitch On/Off
69O Hold 2 On/Off
70 Sound Controller 1 (Sound Variation)
71 Sound Controller 2 (Timbre/Harmonic Intensity)
72 Sound Controller 3 (Release Time)
73 Sound Controller 4 (Attack Time)
74 Sound Controller 5 (Brightness)
75 Sound Controller 6 (Decay Time)
76 Sound Controller 7 (Vibrato Rate)
77 Sound Controller 8 (Vibrato Depth)
78 Sound Controller 9 (Vibrato Delay)
79 Sound Controller 10 (undefined)
80O General Purpose Controller 5
81O General Purpose Controller 6
82O General Purpose Controller 7
83O General Purpose Controller 8
84O Portamento Control
88O High Resolution Velocity Prefix
91 Effects 1 Depth (Reverb Send Level)
92 Effects 2 Depth (formerly Tremolo Depth)
93 Effects 3 Depth (Chorus Send Level)
94 Effects 4 Depth (formerly Celeste [Detune] Depth)
95 Effects 5 Depth (formerly Phaser Depth)
96 Data Increment (Data Entry +1)
97 Data Decrement (Data Entry -1)

O Optional (not widely implemented).

Registered Parameter Numbers

Registered Parameters provide additional control over instrument setup. Control Changes #101 and #100 select the parameter number, then Control Changes #6 and #38 set the actual data, while #96 and #97 set relative changes. The same approach is used for Non-Registered Parameter Numbers .

MIDI 1.0 Registered Parameter Numbers (RPN)
Parameter Numbers Function Data Entry
CC#101 CC#100 CC#6 / CC#38
0x00 0x0 Pitch Bend Sensitivity +/- semitones, =+/--cents
0x1 Channel Fine Tuning 0x4000 = 440 Hz, range +/-100 cents
0x2 Channel Coarse Tuning 0x4000 = 440 Hz, resolution 100 cents
0x3 Tuning Program Change Tuning Program Number
0x4 Tuning Bank Select Tuning Bank Number
0x5 Modulation Depth Range Defnined by General MIDI Level 2
0x6 MPE Configurarion Message Defined by MIDI Polyphonic Expression
0x3D 0x0 Azimuth Angle Three Dimensional Sound Controllers (RP-049)
0x1 Elevation Angle
0x2 Gain
0x3 Distance Ratio
0x4 Maximum Distance
0x5 Gain at Maximum Distance
0x6 Reference Distance Ratio
0x7 Pan Spread Angle
0x8 Roll Angle
0x7F 0x7F Null Function Number Disable the data entry, data increment, and data decrement controllers

Channel Mode messages

Channel Mode messages are controller changes 120-127 which affect the entire instrument; they include the Omni/mono/poly mode on and off messages, as well as messages to reset all controllers to their default state or to send "note-off" messages for all notes.

MIDI 1.0 Channel Mode Controllers
CC# Name Description
120 All Sound Off
121 All Controllers Off
122 Local Control On/Off Value ≤63 Off, ≥64 On
123 All Notes Off
124 Omni Off
125 Omni On
126 Mono On (Poly Off)
127 Poly On (Mono Off)

System Common messages

System messages contain meta-data about other MIDI messages. A sequencer, for example, often sends MIDI clock messages during playback that correspond to the MIDI timecode, so the device receiving the messages (usually a synthesizer) will be able to keep time. Also, some devices will send Active Sense messages, used only to keep the connection between the sender and the receiver alive after all MIDI communication has ceased. MIDI time code is an example of a System Common message. System messages do not include channel numbers, and are received by every device in the MIDI chain.

MIDI 1.0 System Common messages
Event Status byte Byte 2 Byte 3 Description
MIDI Time Code 0xF= 0b1111 0x1= 0b0001 Timecode Piece Does not appear
Song Position Pointer 0x2= 0b0010 LSB MSB 14-bit number of beats (​116 notes)
Song Select 0x3= 0b0011 Song Number Does not appear
Tune request 0x6= 0b0110 Does not appear

System Exclusive messages

System Exclusive (SysEx) messages are proprietary manufacturer's defined control data. SysEx messages are addressed to a specific device in a system. Each manufacturer has a unique identifier and instruments also include a SysEx ID setting, to address two devices of the same model independently.

Manufacturer's System Exclusive messages (also known as Manufacturer SysEx, Manuf Sysx, etc.) are defined by the manufacturer of the sequencer/synthesizer and can be any length. These messages are commonly used to send non-MIDI data over a MIDI connection, such as patch settings, a sound sample, or a sequencer's memory dump. Because they are defined by the device's manufacturer, they are mainly used for backup purposes and rarely (if ever) useful in another MIDI device.

MIDI 1.0 System Exclusive messages
Event Status byte Description
System Exclusive 0xF= 0b1111 0x0= 0b0000
End System Exclusive 0x7= 0b0111

Start of SysEx is followed by either a Manufacturer ID byte, or three Manufacturer ID bytes when the first byte is zero:

F0 <ID number> <data Bytes>... F7
F0 00 <ID number> <ID number> <data Bytes>... F7

ID number and data bytes use 7-bit values and their high bit is always set to 0.

Universal System Exclusive messages

Universal System Exclusive messages are formed from Manufacturer ID number 0x7E for non-realtime and 0x7F for realtime messages, a SysEx 'Device ID' (SysEx 'channel' set in each instrument's settings) or 0x7F to broadcast to all devices, then one or two Sub-ID bytes to indicate function then data bytes:

F0 <7E or 7F> <device ID> <sub ID#1> ... <data Bytes> ... F7

They include the significant MIDI Machine Control and MIDI Show Control extensions which enable all types of equipment to easily communicate with each other, as well as MIDI Time Code and MIDI tuning standard.

MIDI 1.0 Universal System Exclusive - Non-Realtime (7E) messages[2]
SUB-ID1#
MSB
SUB-ID2
LSB
Name Description
0x1 Sample Dump Header
0x2 Sample Data Packet
0x3 Sample Dump Reqest
0x4 MIDI Time Code
0x0 Special
0x1 Punch In Points
0x2 Punch Out Points
0x3 Delete Punch In Point
0x4 Delete Punch Out Point
0x5 Event Start Point
0x6 Event Stop Point
0x7 Event Start Points with additional info
0x8 Event Stop Points with additional info
0x9 Delete Event Start Point
0xA Delete Event Stop Point
0xB Cue Points
0xC Cue Points with additional info
0xD Delete Cue Point
0xE Event Name in additional info
0x5 Sample Dump Extensions
0x1 Loop Points Transmission
0x2 Loop Points Request
0x3 Sample Name Transmission
0x4 Sample Name Request
0x5 Extended Dump Header
0x6 Extended Loop Points Transmission
0x7 Extended Loop Points Request
0x6 General Information
0x1 Identity Request
0x2 Identity Reply
0x7 File Dump
0x1 Header
0x2 Data Packet
0x3 Header
0x4 Request
0x8 MIDI Tuning Standard (Non-Real Time)
0x0 Bulk Dump Request
0x1 Bulk Dump Reply
0x2 reserved
0x3 Tuning Dump Request
0x4 Key-Based Tuning Dump
0x5 Scale/Octave Tuning Dump, 1 byte format
0x6 Scale/Octave Tuning Dump, 2 byte format
0x7 Single Note Tuning Change with Bank Select
0x8 Scale/Octave Tuning, 1 byte format
0x9 Scale/Octave Tuning, 2 byte format
0x9 General MIDI
0x1 General MIDI 1 System On
0x2 General MIDI 1 System Off
0x3 General MIDI 2 System On
0xA Downloadable Sounds
0x1 Turn DLS On
0x2 Turn DLS Off
0x3 Turn DLS Voice Allocation Off
0x4 Turn DLS Voice Allocation On
0xB File Reference Message
0x1 Open File
0x2 Select or Reselect Contents
0x3 Open File and Select Contents
0x4 Close File
0xC MIDI Visual Control
0xD MIDI Capability Inquiry
0x7B End of File
0x7C Wait
0x7D Cancel
7E NAK
7F ACK
MIDI 1.0 Universal System Exclusive - Realtime (7F) messages[2]
SUB-ID1#
MSB
SUB-ID2
LSB
Name Description
0x1 MIDI Time Code
0x2 MIDI Show Control
0x3 Notation Information
0x1 Bar Number
0x2 Time Signature (Immediate)
0x42 Time Signature (Delayed)
0x4 Device Control
0x1 Master Volume
0x2 Master Balance
0x3 Master Fine Tuning
0x4 Master Coarse Tuning
0x5 Global Parameter Control
0x5 Real Time MTC Cueing
0x0 Special
0x1 Punch In Points
0x2 Punch Out Points
0x3 reserved
0x4 reserved
0x5 Event Start points
0x6 Event Stop points
0x7 Event Start points with additional info
0x8 Event Stop points with additional info
0x9 reserved
0xA reserved
0xB Cue points
0xC Cue points with additional info
0xD reserved
0xE Event Name in additional info.
0x6 MIDI Machine Control Commands
0x7 MIDI Machine Control Responses
0x8 MIDI Tuning Standard (Real Time)
0x2 Single Note Tuning Change
0x7 Single Note Tuning Change with Bank Select
0x8 Scale/Octave Tuning, 1 byte format
0x9 Scale/Octave Tuning, 2 byte format
0x9 Controller Destination Setting (GM2)
0x1 Channel Pressure (Aftertouch)
0x2 Polyphonic Key Pressure (Aftertouch)
0x3 Controller (Control Change)
0xA 0x1 Key-based Instrument Control
0xB 0x1 Scalable Polyphony MIDI MIP Message
0xC 0x0 Mobile Phone Control Message

System Real-Time messages

System Real-Time messages provide means for synchronization, and include MIDI clock and Active Sensing.

MIDI 1.0 System Realtime messages
Event Status byte Description
Timing clock 0xF= 0b1111 0x8= 0b1000
MIDI tick 0x9= 0b1001
Start 0xA= 0b1010
Continue 0xB= 0b1011
Stop 0xC= 0b1100
Active Sensing 0xE= 0b1110
Reset 0xF= 0b1111

Implementation chart

Devices typically do not respond to every type of message defined by the MIDI specification. A device can be configured to only listen to specific channels and to ignore the messages sent on other channels ("Omni Off" mode), or it can listen to all channels, effectively ignoring the channel address ("Omni On").

An individual device may be monophonic (the start of a new "note-on" MIDI command implies the termination of the previous note), or polyphonic (multiple notes may be sounding at once, until the polyphony limit of the instrument is reached, or the notes reach the end of their decay envelope, or explicit "note-off" MIDI commands are received). Receiving devices can typically be set to all four combinations of "omni off/on" versus "mono/poly" modes.

The MIDI implementation chart was standardized by the MMA as a way for users to see what specific capabilities an instrument has, and how it responds to messages. A specific MIDI Implementation Chart is usually published for each MIDI device within the device documentation.

Bandwidth

The serial nature of MIDI messages means that long strings of MIDI messages take an appreciable time to send, at times even causing audible delays, especially when dealing with dense musical information or when many channels are particularly active.

Hardware transport

Connectors

MIDI connectors are standard 5-pin 180° DIN connectors. Only two of the five pins (pins 4 and 5) are used for MIDI signal transmission.

Most MIDI capable instruments feature a MIDI IN, MIDI OUT, and occasionally a MIDI THRU connection in the form of five-pin DIN connectors. In order to build a two-way physical connection between two devices, a pair of cables must be used. The MIDI THRU jack simply echoes the signal entering the device at MIDI-IN. This makes it possible to control several devices from a single source.

Computer sound cards included a game ports with 15-pin D-subminiature connectors that provides MIDI IN/MIDI OUT- a short adapter cable can converts the D-subminiature pinout into standard DIN connectors.[3]

Electrical interface

MIDI interconnection schematic
An electrical schematic of the MIDI electrical/optical interconnection.

The MIDI specification for the electrical interface is based on a fully isolated current loop. It provides a one-way (simplex) digital current loop electrical connection sending asynchronous serial communication data at 31,250 bits per second. The serial transmission comes in 8-N-1 format, i.e. one start bit (must be 0), eight data bits, no parity bit and one stop bit (must be 1), so up to 3,125 bytes per second can be sent

The current loop on the transmitter side drives the LED of an opto-isolator on the receiver side. The MIDI Out port nominally provides a +5 volt source through a 220 ohm resistor out through pin 4 on the DIN connector, in on pin 4 of the receiving device's MIDI In connector, through a 220 ohm protection resistor and the LED of an opto-isolator. The current then returns via pin 5 on the MIDI In port to the originating device's MIDI Out port pin 5, again with a 220 ohm resistor in the path, giving a nominal current of about 5 milliamperes.

Only one end of the loop is referenced to ground, with the other end "floating", to prevent ground loops which may otherwise cause interference and hum in analog audio signals. The MIDI specification provides for a ground "wire" and a braid or foil shield, connected on pin 2, protecting the two signal-carrying conductors on pins 4 and 5. However to improve EMI/EMC performance and filtering of RF noise, shield can be connected to ground directly or through a small ceramic capacitors and ferrite beads can be installed in the signal path.[4] The maximum distance is specified at 15 meters (50 feet), although it can normally go much farther.[5]

Signal flow

The opto-isolator must be a high-speed type, with less than 2 μs risetime. As most opto-isolators have asymmetrical positive-going and negative-going slew rates, they slightly alter the signal's duty cycle. If several MIDI devices are connected in series by daisy-chaining the MIDI THRU to the next device's MIDI-IN, the signal gets more and more distorted, until receive errors occur due to pulse narrowing.

At the physical layer (MIDI cable), a pair of wires carry the MIDI signal. The voltage difference is normally 0 volts (both at positive potential referenced to ground) in the idle state, which is seen as a '1' at the MIDI receiver due to logic inversion by the Opto-isolator. A MIDI message start bit (0) causes a voltage differential on the wire pair (current loop) which is seen at the MIDI receiver as a '0'. The 8 data bits can be either '0' (low) or '1' (high) with the stop bit (1) seen at the MIDI receiver as a '1'. To summarize:

  • Logic 1 → High → no current flow → Opto-isolator LED off → MIDI receiver sees High, logic '1' (data bits, stop bit or idle)
  • Logic 0 → Low → current loop flow → Opto-isolator LED on → MIDI receiver sees Low, logic '0' (data bits, start bit)

See also

References