GENMIDI

GENMIDI is a WAD lump that contains instrument data for the DMX sound library to use for OPL synthesis. Given an *.OP2 extension, it can be used in MUSPlayer.

The lump is a database of OPL register values, used to program the OPL chip found in the Adlib and Sound Blaster sound cards. It contains 175 entries, one for each of the 128 standard General MIDI instruments and 47 percussion effects.

Doom and Doom II have different GENMIDI lumps, but Final Doom reuses the Doom II set, resulting in a different sound for the Doom tracks used in Plutonia. Heretic, Hexen, and the Strife demo, on the other hand, use the standard DMX set. The retail version of Strife provides its own set, derived from the Doom II set.

Header
The lump has an 8-byte ASCII header, containing the text "#OPL_II#".

Instrument data
The header is followed by 175 36-byte records of instrument data.

Each record has a 4 byte header of the following form:

The flags value is a bitfield containing several flags that control the record. These are:

Following the header are two 16 byte records of OPL voice data. If the double voice bit is set in the header, both voices will be played simultaneously; otherwise, only the first set of voice data is played.

The voice data has this format:

This data is essentially the same as the data found in Soundblaster SBI files; the differences are that the data is ordered differently, and the key scale and output level fields are split into two separate bytes within GENMIDI. In the SBI format, they are combined as bitfields within a single byte. For this reason, and because of the extra unused fields, the GENMIDI instrument data is longer (16 bytes) than SBI data (11 bytes).

Instrument names
Following the instrument data is 175 32-byte ASCII fields containing the names of the standard General MIDI instruments. It is not clear how these names are used within the sound code, if at all.

Waveform support
All stock GENMIDI Instruments are designed to play on OPL2, so none of the OPL3 waveforms are ever used. However, DMX supports the additional 4 waveforms provided by the OPL3 chip, provided that DMX is set to OPL3 mode.

Use in modern ports
Most modern operating systems do not provide the ability to program the OPL chip directly; indeed, most modern computers do not even contain OPL-compatible sound chips. It is therefore common for source ports to simply use the standard MIDI playback API, and the GENMIDI lump is not used. There are a few source ports which do use the GENMIDI lump; particularly as it is necessary when performing OPL emulation. Ports with GENMIDI support include Chocolate Doom and ZDoom.