|Extended Multiple Instrument Digital Interface|
Extended Multiple Instrument Digital Interface (XMI) is a MIDI-like format that was created by John Miles originally for use with the Audio Interface Library (later called the Miles Sound System), an audio driver and software API he developed and released in 1991. The format and its library became very popular among DOS games in the 1990s, but fell out of favor in the late 1990s as computing power increased to allow for PCM music.
Like MIDI, XMI files store only the notes of the song. Instrument definitions and hardware specific instructions must be handled externally, a problem that required most game developers of the time to have to write their own audio drivers for every target device. The Miles Sound System solved this problem by including a wide variety of audio drivers for all the popular sound cards of the day. The drivers could even be customized by developers. This allowed composers the freedom of MIDI's write once, play everywhere mentality without being limited to MIDI compatible devices.
XMI also offers extra channel support over MIDI, internal looping, compression, and can store up to 10 songs in a single file.
- MIDI (XMPlay) - XMPlay
- MIDI Decoder - foobar2000
- Midpak - DOS
- System Shock Random Song Generator - Windows
- Winamp - Android, Macintosh, Windows
- XMIPlay - DOS
- MIDIPLEX - Windows 32
XMI to ?
? to XMI
How to Obtain
XMI files usually need to be extracted from game resource files, a process that is different for nearly every game that uses the format.
The XMI format is is an IFF variant used to contain MIDI events. The top-level chunk is always FORM. This is followed by an XDIRINFO chunk containing the amount of subsongs contained, written as a 16-bit little-endian integer. After that comes a CAT chunk which contains the collection of subsongs as a series of XMIDFORM, XMIDEVNT, XMIDTIMB, and EVNT chunks. All XMI files end with hex values "FF 2F" followed by one or two nulls.
XMI files play MIDI at a fixed clock rate of 120 Hz. To play them correctly, the Tempo and PPQN division values used for playback should therefore also yield a constant 120 Hz, for example a tempo of 500 000 microseconds and a PPQN of 60, or a tempo of 1 000 000 microseconds and a PPQN of 120. Tempo events contained in the EVNT chunks should be ignored; they are vestigial remnants of the original MIDI file converted into the XMI format and do not correspond to the values used by the converted event stream.
All XMI files use IFF tree structure, and the identifiers are XDIR and XMID.
IFF Tree Structure
File Root │ ├─ FORM:XDIR - IFF header │ └─ INFO - Info chunk │ └─ CAT :XMID - IFF subheader (catalog) ├─ FORM:XMID - Subsong #1 │ ├─ TIMB - Timbre chunk (optional) │ └─ EVNT - MIDI events chunk ├─ FORM:XMID - Subsong #2 │ └─ ... └─ ...