Difference between revisions of "MDI"

From Video Game Music Preservation Foundation Wiki
Jump to: navigation, search
m (Not designed to output MIDI)
(Instrument Structure: Mention structure is identical to BNK)
Line 127: Line 127:
===Instrument Structure===
===Instrument Structure===
Instrument parameters are expressed with this structure:
Instrument parameters are expressed with this structure: (which is identical to the structure for an instrument inside a [[BNK]] file)
{{Table Header
{{Table Header
Line 180: Line 180:
| <tt>UINT8</tt> || <tt>con</tt>        || Connector [op 0 only, op 1 ignored] || 0xC0 (bit 0, inverted)
| <tt>UINT8</tt> || <tt>con</tt>        || Connector [op 0 only, op 1 ignored] || 0xC0 (bit 0, inverted)
===Channel Utilization===
===Channel Utilization===

Revision as of 09:17, 25 January 2015

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: ?
  • *.mdi

The MDI format was created by Ad Lib, Inc. to upgrade from ROL format. It uses the MIDI structure but incorporates OPL2 commands that allow it to store instrument data and change modes, similar to how CMF works. Because the format is so similar to MIDI, some MIDI players are able to play the files, though they won't utilize the instrument data or set the song into the correct mode, so the song won't sound correct. The players which can play MDI files correctly are listed below.





MDI to ?

? to MDI






1990-??-?? Golden Axe (DOS)
1991-??-?? Dark Ages (DOS)
1991-??-?? Prehistorik (DOS)
1992-??-?? Amberstar (DOS)
1992-??-?? Gear Works (DOS)
1992-??-?? Starfire (DOS)
1993-??-?? Ultimuh MCMLXVII (DOS)


  • All MDI files begin with "MThd" MIDI header and contain "MTrk" at the start of the MIDI track.
  • The End Of Track "FF 2F 00" event is located at the end of file, but not included in the track.
  • Some Note Off events may have only Velocity parameter to trigger the note off.
  • Program Change events are not used in the track.

Sequencer-Specific Event Format

These events are used to control OPL-compatible chip.




Ad Lib ID&#x000D;



00 FF 7F XX 00 00 3F XX XX XX .. XX

Possible Opcodes



Byte #&#x000D;


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 1 1 - 12 inclusive

Instrument Structure

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

Data type&#x000D;



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&#x000D;



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 (AdLib) format.

Hex channel&#x000D;

MIDI channel&#x000D;

Use in melodic mode&#x000D;

Use in percussive mode

0x00 1 Normal instrument Normal instrument
0x01 2 Normal instrument Normal instrument
0x02 3 Normal instrument Normal instrument
0x03 4 Normal instrument Normal instrument
0x04 5 Normal instrument Normal instrument
0x05 6 Normal instrument Normal instrument
0x06 7 Normal instrument Bass drum
0x07 8 Normal instrument Snare drum
0x08 9 Normal instrument Tom tom
0x09 10 Unused Top cymbal
0x0A 11 Unused Hi-hat cymbal
0x0B 12 Unused Unused
0x0C 13 Unused Unused
0x0D 14 Unused Unused
0x0E 15 Unused Unused
0x0F 16 Unused Unused

Default Timbre

Player should load this timbre if it isn't loaded by sequencer-specific event before:

OPL base register&#x000D;



0x20 0x01 Modulator characteristic (Mult, KSR, EG, VIB and AM flags)
0x23 0x11 Carrier characteristic (Mult, KSR, EG, VIB and AM flags)
0x40 0x4F Modulator key scaling/output level
0x43 0x10 Carrier key scaling/output level
0x60 0xF1 Modulator attack/decay level
0x63 0xF2 Carrier attack/decay level
0x80 0x53 Modulator sustain/release level
0x83 0x74 Carrier sustain/release level
0xE0 0x00 Modulator wave select
0xE3 0x00 Carrier wave select
0xC0 0x06 Feedback/connection