A short account of the nature and origins of MIDI.
Midi History A very short history.
A Simple Midi Setup Rather like the one I have.
Midi Messages A summary of the available messages and their encodings.
Key to Abbreviations Key to abbreviations used in table of message types.
Standard Midi Files How midi is stored in files.
Timing Info in Midi Files There are several different kinds of information in midi files which relate to the timing of the music.
The Future of Midi Some possibilities for where Midi is going.
Sources Some of the sources I have used in compiling this page.

Midi History:

See also: What is MIDI?
and The Beginnings of MIDI?:
A very short history.
0. What is Midi?
MIDI stands for Musical Instrument Digital Interface, and is a standard for connecting together digital electronic musical instruments.
2. Universal Synthesizer Interface
Dave Smith and Chet Wood, then working for a company called Sequential Circuits, devised a Universal Synthesizer Interface to overcome this problem (probably with some input from Roland). Their proposal was presented to the Audio Engineering Society in autumn 1981, and provided a starting point for the development of the Midi standard.
4. Further Development
The original Midi specification was later augmented in the following ways:
  • a file format specification (SMF - Standard Midi File) describing how midi data should be saved in files (from Opcode)
  • the General Midi (GM) standard, which gave a standard allocation of instruments to program control numbers (used to select the instrument).
  • Midi time code (MTC) for synchronisation (from Digidesign)
  • Midi sample dump standard (SDS).
  • the Roland GS extension to GM, providing for more instruments and sound effects.
  • the Yamaha XG extension, also allowing more instruments than GM (XG reading and specs).
  • GM-2, the General MIDI Level 2 Specification is second version of General Midi allowing, among other things, for many more patches.
GS, XG and Midi Level 2 all include "bank switching" to give more voices.
1. The Beginnings
As electronic instruments began to go digital a number of manufacturers, including Roland, Oberheim, Sequential Circuits and Fender Rhodes, developed digital interfaces which allowed their own digital instruments to work together, but these proprietary interfaces did not permit interworking between devices developed by different manufacturers.
3. Midi 1.0
Over the two years from autumn 1981 to 1983 most of the major manufacturers collaborated in the development of the first version of the Midi standard, which was published in October 1983. There were by this time already Midi devices in the marketplace, the first of which was Sequential's Prophet 600 which first shipped in December 1982.

The Midi 1.0 standard provides:

The Midi Manufacturers Association (MMA) was set up with responsibility for maintenance and development of the standard.

A Simple Midi Setup:

The Components
The system shown consists of a digital keyboard (mine is a Yamaha CLP500), a computer (I have an Atari in this position), and a synthesiser box (I have a Kawai K1m).
The Connections
Midi signals are fed from the keyboard, into the computer and from the computer via the synthesizer back to the keyboard. A key depression on the keyboard can be recorded on the PC and then passed on to the synthesizer for action, and eventually returns to the keyboard, which can be set either for local or remote control.
The system can be used to make a midi recording of a solo instrumental piece, by setting a sequencer on the computer to record and performing the piece on the keyboard. While recording the music would be heard live from either or both of the piano or synthesizer.

A piece for ensemble or orchestra can be recorded one instrument at at time in a similar manner.

The setup is convenient either for performance/production of existing compositions, or for creating new compositions. In the latter case the composition can be entered as it is created through the keyboard and at all stages composition can proceed in the audible context of the parts already composed.

Midi Messages:

A concise presentation of the messages.
Status Bytes
0channelNote Offkeyvel
1channelNote Onkeyvel
2channelAfter Touchkeyvel
3channelControl Changeconval
4channelProgram Changeprg
5channelChannel Pressureval
6channelPitch Wheellsbmsb
System Common
0System Exclusive*data*
2Song Position Pointerlsbmsb
3Song Selectsong
6Tune Request
7EOX (end of system exclusive)
System Realtime
0Timing Clock
6Active Sensing
7System Reset (realtime) or Meta Event (in file)*data*

Key to Abbreviations
keykey number (0-127, middle C = 60, others by distance in semitones from middle C)
channela number in range 0-15 (add one to get channel number)
concontrol number
lsbleast significant byte (lowest 7 bits of 14 bit value)
msbmost significant byte (highest 7 bits of 14 bit value)
prgprogram number (selects instrument sound)
songsong number (selects a pattern?)
valcontrol value
velvelocity (determines volume)
*data*variable length data, begining with length as a variable length quantity

Standard Midi Files:

In order to allow for interchange of midi data between applications a standard file format has been defined.
Midi files contain the midi messages to be sent across the midi cables in the format shown above. Additional information is required to determine the timing of the messages, and further information may be stored which is relevant primarily to software which processes midi file (this kind of information is saves as "meta" messages).
Midi files are divided into "chunks" (rather like RIFF files, but not the same). There are two types of chunk with identifiers "MThd" (header) and "MTrk" (track). There must be exactly one header chunk but may be more than one track chunk.
File Formats
There are three file "format"s available, and the header chunk identifies which format is in use. Format 0 files have only one track chunk. Format 1 files may have more than one track (which may or may not correspond to the tracks visible in a sequencer). The number of tracks is specified in the header chunk. All of the tracks in a format 1 file are intended to be played together (i.e. concurrently). Format 2 files have more than one track and these are considered quite independent and are not intended to be played concurrently. Some sequencers break a "song" into "patterns" and "patterns" into tracks. Such a sequencer could save all the tracks for each pattern in a separate track chunk in the midi file.
Track Chunks
Track chunks mainly contain midi messages, each preceded by a timestamp relative to the previous message (i.e. indicating the time which should elapse between sending the two messages). They do not contain midi "realtime" messages, but do contain extra information as "meta messages".

Timing Info in Midi:

There are several different kinds of information in midi files which relate to the timing of the music.
There are two different methods of synchronisation. SMTPE and MTC. SMTPE originates in the movie industry and uses a frame as the unit of time. To give the extra precision needed for music, midi timings make use also of subframes. MTC is midi's own timing method based on 24ths of a quarter note. This is the frequency with which midi time clock messages are sent out for synchronization. Time stamps for the relative timing of messages in a midi file are also specified using fractions of a quarter note, but this will usually be a smaller unit than a 24th of a quarter note.

The header chunk specifies the timing units either using SMTPE or MTC and the track chunks then use these timing units for timestamps on messages. Timing may also be modified by tempo and time signature messages.

Sources of Timing Info
The following bits of timing info may be available:
  • The header chunk
  • Message timestamps
  • Tempo messages
  • Time signature messages
  • SMTPE offset
  • Cue points
The Header Chunk and Timestamps
The header chunk has a field called "division" which determines the timing units. This is specified either as the number of frames per second and the number of subframes per frame for SMTPE, or as the number of pulses per quarter note (PPQN). In the former case the timing is done by subframe and the size of this unit of time is 1000/(f * s) milliseconds, (one thousand divided by the product of the number of frames per second and the number of subframes per frame). In the latter case the length of the timing units is given relative to the length of one quaver, and is therefore not fixed until the tempo is known (temp is number of beats, i.e. crotchets, per minute), which will be set and may be varied by tempo messages in the following tracks.
Tempo Messages
It is recommended but not required that all tempo messages are included in a separate track (for format 1 files). Tempo is specified using a tempo meta message (code xFF51) which gives the number of beats per minute. This is only relevant to the interpretation of timestamps if the division information in the header has specified the number of pulses per quarter note. The relative time determined by a timestamp TS is then TS*60/(PPQN*TEMPO) in seconds.
Time Signature
A time signature may also be provided, using meta message code xFF58. The time signature serves primarily to determine the division of the music into bars, and is specified as number of notes per bar and duration of each note as a fraction of a note specified as a power of two.

The time signature message also includes two other items of information. It specifies the number of MTC clicks per quarter note (which is normally 24), and the number of thirty second notes per quarter note, (which is of course normally 8). I don't know what is the intended effect of using non standard values for these.

SMTPE Offset
Meta message code xFF54 gives the SMTPE time for the start of the piece, which is encoded as five bytes giving hours, minutes, seconds, frames and hundredths of a frame in that order.
Cue Points
Meta message xFF07 give text describing the some event, e.g. triggering play of an audio file. The timing of this cue is determined by the timestamp on the cue message.

The Future of Midi:

As the inevitable march of technology strides forward what is lies in the future of midi?
Midi was once thought a format for distributing music, but has largely been eclipsed by formats such as mp3. Its use by gaming software has probably now has a similar fate (but I don't know much about this myself).

For applications in the production rather than the consumption of music formats like mp3 have less value, you can't use mp3 to connect electronic instruments to a keyboard, but eventually it may be superseded by more modern interface technologies even in this domain.

Various technologies have been mooted to replace the midi cable. This one from Yamaha may well prevail:
  • mLAN - Yamaha's new music networking technology based on Firewire (the IEEE 1394 high performance serial bus).
Presumably the existing midi cables will continue to be supported for a long time yet.


Some of the sources I have used in compiling this page.
There are some links to useful web pages provided above. The single site I have found most useful for my purposes has been Midi Technical Fanatic's Brainwashing Center.
Among the books on Midi I have referred to are: The Midi Manual by David Miles Huber, Midi for the professional by Paul D. Lerhman and Tim Tully and Beyond Midi, edited by Selfridge-Field.


UP HOME © RBJ created 2003-2-11 modified 2003-3-6