The GENMIDI lump is used in Doom and other Doom-engine games to initialize the registers for the MIDI instruments in an OPL chip. ZDoom has an OPL emulation feature and can make use of this lump.
The lump has an 8-byte ASCII header, containing the text "#OPL_II#".
The header is followed by 175 36-byte records of instrument data. Records are little-endian.
Each record has a 4 byte header of the following form, Followed by 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.
|0-1||2|| Flags: a bitfield that control the record.
|2||1||Fine tuning - This normally has a value of 128, but can be adjusted to adjust the tuning of the instrument. This field only applies to the second voice of double-voice instruments; for single voice instruments it has no effect. The offset values are similar to MIDI pitch bends; for example, a value of 82 (hex) in this field is equivalent to a MIDI pitch bend of +256.|
|3||1||Note number used for fixed pitch instruments (see below)|
|4||1||Modulator Tremolo / vibrato / sustain / KSR / multi|
|5||1||Modulator Attack rate / decay rate|
|6||1||Modulator Sustain level / release rate|
|7||1||Modulator Waveform select|
|8||1||Modulator Key scale level|
|9||1||Modulator Output level|
|11||1||Carrier Tremolo / vibrato / sustain / KSR / multi|
|12||1||Carrier Attack rate / decay rate|
|13||1||Carrier Sustain level / release rate|
|14||1||Carrier Waveform select|
|15||1||Carrier Key scale level|
|16||1||Carrier Output level|
|18-19||2||Base note offset. This is used to offset the MIDI note values. Several of the GENMIDI instruments have a base note offset of -12, causing all notes to be offset down by one octave.|
|20-35||16||Second voice, same layout as 4-19.|