MDI

From Video Game Music Preservation Foundation Wiki
Jump to: navigation, search
Ad Lib MIDI
MDI.png
Developer: Ad Lib, Inc.
Header: SMF
Content: Notational
Instruments: Internal
Target Output
Output - Digital Audio - No.png Output - MIDI - No.png Output - FM Synthesis.png Output - PSG - No.png
Released: 1989-05-08
First Game: AdLib (DOS)
Extensions
  • *.mdi

The MDI format was created by Ad Lib, Inc. to supersede their MUS (AdLib) format. It uses the MIDI structure but is designed to work with the OPL2 sound chip that allow it to store instrument data and change modes.

Because the format is so similar to MIDI, some MIDI players are able to play the files, but discordantly use a piano for everything (even drums) and in most cases don't release any notes. The players which can play MDI files correctly are listed below.

There don't appear to be any MDI players that support looping. This is needed to make proper recordings.

Players

(Category)

Editors

(Category)

Converters

(Category)

MDI to ?

? to MDI

Games

(Category)
Released Title Sample Notes
1990-09-20 AdLib (DOS)
Note Off correct.
1990-??-?? Golden Axe (DOS) Note Off 0.
1991-0?-?? Atomino (DOS) Note Off 0.
1991-??-?? Battle Isle (DOS) Note Off 0.
1991-??-?? Dark Ages (DOS)
Note Off 0.
1991-??-?? Dragonflight (DOS) Note Off 0.
1991-??-?? Jumpman Lives! (DOS) Note Off correct.
1991-??-?? Prehistorik (DOS)
Note Off 0.
1991-??-?? Pro Tennis Tour 2 (DOS) Note Off 0.
1992-0?-?? Clik Clak (DOS) a.k.a. Gear Works (DOS)
Note Off correct.
1992-??-?? 3D World Tennis (DOS) Note Off correct.
1992-??-?? Adventure Math (DOS)
Note Off 0.
1992-??-?? Adventure Math Deluxe (DOS)
Note Off 0.
1992-??-?? Amberstar (DOS)
Note Off 0.
1992-??-?? Galactix (DOS)
Note Off correct.
1992-??-?? Starfire (DOS) Note Off correct.
1993-??-?? Ultimuh MCMLXVII (DOS) Note Off correct.
1994-08-23 Microsoft Space Simulator (DOS) Note Off correct.
199?-??-?? St. Thomas (DOS) Note Off 0.

How to Obtain

MDI files usually have to be manually extracted from game files, a process that is different for pretty much every game that uses them.

Technical

  • All MDI files begin with "MThd" MIDI header and contain "MTrk" at the start of the MIDI track.
  • The End Of Track "00 FF 2F 00" event is located at the end of file, but not included in the track.
  • In Ad Lib's MIDI Play, all aftertouch events and the velocity parameter in Note On events equally control the specified channel's volume, though Ad Lib's ROL to MIDI does not output polyphonic aftertouch (0xA0–0xAF).
  • Note Off events just release the most recent note on specified channel. The note and velocity parameters are ignored. The common version of ROL to MIDI sets the note parameter to 0 (see above).
  • Control Change and Program Change events have no effect.

Sequencer-Specific Event Format

These events are used to control any OPL-compatible chip.

Event Length AdLib ID Opcode Data
FF 7F XX 00 00 3F XX XX XX .. XX

Possible Opcodes

Opcode Meaning Byte # Description
00 01 Patch (instrument change) 1 Voice / channel number for instrument
2–29 28 byte array of parameters (see structure below)
00 02 Card mode 1 0 = melodic, 1 = percussive
00 03 Pitch bend sensitivity (same as Registered Parameter 0) 1 1–12 inclusive

Instrument Structure

Instrument parameters are expressed with the structure, which is identical to the structure for an instrument inside a BNK file:

Data type Name Description
MDI_OPLREGS oplModulator Register values for the Modulator operator (op 0)
MDI_OPLREGS oplCarrier Register values for the Carrier operator (op 1)
UINT8 iModWaveSel Modulator wave select (OPL base register 0xE0)
UINT8 iCarWaveSel Carrier wave select (OPL base register 0xE0)


The MDI_OPLREGS structure is defined as:

Data type Name Description OPL base register
UINT8 ksl Key scaling level 0x40 (bits 6-7)
UINT8 multiple Frequency multiplier 0x20 (bits 0-3)
UINT8 feedback Feedback [op 0 only, op 1 ignored] 0xC0 (bits 1-3)
UINT8 attack Attack rate 0x60 (upper four bits)
UINT8 sustain Sustain level 0x80 (upper four bits)
UINT8 eg Envelope gain (nonzero value is on) 0x20 (bit 5)
UINT8 decay Decay rate 0x60 (lower four bits)
UINT8 releaseRate Release rate 0x80 (lower four bits)
UINT8 totalLevel Total output level 0x40 (bit 0-5)
UINT8 am Amplitude modulation (Tremolo) 0x20 (bit 7)
UINT8 vib Frequency Vibrato 0x20 (bit 6)
UINT8 ksr Key scaling/envelope rate 0x20 (bit 4)
UINT8 con Connector [op 0 only, op 1 ignored] 0xC0 (bit 0, inverted)

Channel Utilization

The channel utilization is the same as in the MUS format, except the music can be composed in both melodic and percussive modes, since the format supports mode switching during playback.

Default Timbre

Every player should load default timbre if it isn't loaded by sequencer-specific event before.

Links