(compMus1) Intro to MIDI


  • MIDI stands for Musical Instrument Digital Interface.
  • It is a specification for physically connecting devices (interface standard), and for communicating between them (communications messaging protoc0l).
  • It was designed for real-time keyboard performance, originally connecting analog synthesis devices (although it is a digital language).
  • It is a control language – it transmits performance instructions rather than audio.

History (the dark ages: 1970s)

  • No synthesizer could communicate with another synthesizer or computer without proprietary methods.
  • Each synth would have its own keyboard, controlling its own synthesis system, with its own sequencer. (‘70s Rock – wall of keyboards)

Birth of MIDI

  • Several synth makers came together to agree on MIDI standard in 1981 (after development of inexpensive microcontrollers).
  • Designed to be relatively inexpensive.
  • First MIDI instruments available in 1983. (MIDI spec defined in 1982.)
    (E/E is wrong with 1984 date on p. 227.)
  • MIDI is still the main way musical hardware and software communicates today, and still defines most inter-application communication.

MIDI Hardware

  • Cables: 5-pin DIN, male connectors at each end (like RCA cables on home stereo equipment). Only three pins are used. The cables are designed to run at least 15 meters.
  • Ports: IN, OUT, THRU. With a computer interface, THRU often not used.
  • Computer interfaces (with USB and Firewire, can be built into keyboards and other devices). Interface communication speed can be at any rate. Most devices come with a computer interface built in (which connects via USB to computer).
  • Master/Slave arrangements

MIDI Transmission

  • One way – MIDI cables only carry messages in one direction.
    • Bi-Directional communication requires two MIDI cables.
    • Interface cables (USB) can be bidirectional.
  • 16 logical channels. (all channels travel down same physical wires)
  • Binary (like all digital) Data organized into 10-bit words.
  • Serial – one bit at a time.
  • Asynchronous – devices can send messages whenever the device decides.
  • Transmission speed (still at original standard) – 31,250 bits per second (31.25 kbits). Each 10-bit word requires roughly 1/100 of a second to transmit. Most commands require 3 words, or about 3/100 of a second to transmit.

Representation of Data

  • Numbers (all data, whatever it applies to)
  • Most values use a range of 0 – 127 (7 bits = 128 possible values)
  • Pitch: Middle C = 60

MIDI Messages

  • Channel and System messages

Channel Messages

  • Note-on/Note-off (note number, key velocity)
  • Polyphonic and Channel Key Pressure (aftertouch)
  • (Continuous) Control change. CC.
  • Pitch Bend
  • Program Change

System Messages

  • System Exclusive (escape hatch)
  • System Common (for timing and tuning)
  • System Real-Time messages

Structure of a Channel MIDI Message

  • Messages are sent as 10-bit words
  • First and last bit are stripped by UART chip. 8 bits (1 byte) remain.
  • Status byte/Data byte determined by first bit of byte. (1 for status, 0 for data)
  • Status byte indicates a function (note on, note off, cc change, etc.), and MIDI channel.
    • 4 bytes for function; 4 bytes for MIDI channel
    • 4 bytes gives 16 possible values. Hexadecimal notation is often used. 128 values can be represented with only two hexadecimal places. (Base 16, 0 – 9, A – F)
  • Data bytes contain values associated with function in status byte.

The Good

  • One-to-many control
  • Control is independent of synthesis.
  • Digital representation of data allows for computer generation, control, and editing.
  • MIDI data is “portable.”
  • Data can control anything that understands MIDI.

The Bad

  • Lowest common denominator approach.
  • Keyboard bias; event-oriented.
  • Slow communication speeds.
  • Poor data resolution.

The Ugly

  • Not all devices support the same feature sets (you need to look at MIDI implementation charts).
  • Serial communication means that it is impossible to accurately represent simultaneous events.
  • No requirements for how fast a device responds to a message.