-
Notifications
You must be signed in to change notification settings - Fork 42
MIDI
Musical Instrument Digital Interface (MIDI) is a sound format created in the early 1980s by Dave Smith of Sequential Circuits, Inc. in order to make a standard format for storing music definitions. Unlike PCM audio which stores the exact audio, or tracked audio that stores samples, MIDI doesn't store the any sound itself. Instead, MIDI stores the instructions for the audio (kind of like sheet music) which a MIDI device can play back. This allows for much smaller file sizes and consistent, exact timing. However, since all MIDI devices may synthesize sound differently, MIDI music will sound different everywhere it's played.
Most MIDI files are type 1, which means that they have a header for track information and allow multiple tracks. Some MIDI files are type 0, which don't support multiple tracks, and take up slightly less space. There is also a rarely seen type 2 MIDI file which is a type 1 MIDI file with several embedded type 0 MIDI tracks.
Some MIDI files use outdated extensions like MFF (MIDI File Format) or SMF (Standard MIDI File). The KAR extension is used by karaoke software.
The Macintosh uses .MID! files.
MIDI itself is only a standard for a communication format between computers and other digital instruments. The mapping of MIDI "programs" to specific musical instruments was entirely dependent on the MIDI synthesizer. One of the most popular in computer gaming was the Roland MT-32, who appeared in 1987.
To provide a unified standard and avoid cacophony, the MIDI Manufacturer Association created the General MIDI standard in 1991 (often abbreviated GM). The majority of MIDI files are written for this standard. However, finding the standard quite limited and eager to compete by offering additional features, Roland and Yamaha both started to expand on the GM by developing their own proprietary but backward-compatible standards: the Roland GS and the Yamaha XG]. Finally, the MMA released a "second level" to the General MIDI standard, called GM2, which is mostly derived from GS.
An XG, GS or GM2 synthesizer will play a GM MIDI file without problem. Inversely, a GM synthesizer will usually play an XG, GS or GM2 file without much loss beyond a few special effects, although it is possible that they use more simultaneous voices than what the GM standard offers, or undefined instruments. (The XG standard offers up to 1149 different instruments and 128 simultaneous voices; GM is limited to 128 instruments and 24 simultaneous voices.)
However, a MT-32 synthesizer playing a GM song, or a GM synthesizer playing an MT-32 song, will produce fundamentally incorrect playback as the instruments are mapped differently.
In addition to the features offered by the various standards, some sound cards offered additional functions, such as the possibilities to reprogram instruments. Of particular importance are the AdLib and SoundBlaster cards and the Gravis UltraSound (abbreviated GUS) cards.
The AdLib offered FM synthesis with its YM3812 sound chip (better known as OPL2). The OPL2 chip could be reprogrammed by changing the values in its registers to modify the sounds produced.
The GUS used a system of "instrument patches" containing instrument samples to offer high quality MIDI playback. However, the limited RAM on-board the card made it impossible to give each General MIDI instrument its own patch simultaneously. To reduce memory use, configuration files (ultramid.ini) were used to remap instrument to similar patches, making it necessary to optimize such configurations for the instruments used in the songs played. But it was possible to use custom patches, either to improve the quality of certain instruments, or make the patches smaller so more of them could be loaded at once, or even provide entirely new custom instruments.
Many games included multiple variants of their MIDI soundtracks, offering for example an MT-32 version, a GM OPL2 version and a GM wave table version.
For all these reasons, there exist OPL emulators, GUS emulators, and MT-32 emulators in addition to generic MIDI players.
All MIDI files begin with "MThd" which is the start of the MIDI header. There may also be sub-headers in the MIDI file. Inside each header there will be a "MTrk" which signifies the beginning of a track. Type-0 MIDI files only have 1 track, but type-1 files may contain multiple tracks.
All properly formatted MIDI files should end with same three bytes, 0xFF 0x2F 0x00.
- en.wikipedia.org/wiki/MIDI - Wikipedia.
- sonicspot.com/guide/midifiles.html - The Sonic Spot - MIDI technical specifications.
- shikadi.net/moddingwiki/MID_Format - Shikadi - More tech specs.