GENMIDI

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.

Lump format

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. 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.

Offset Size (bytes) Description
0-12Flags: a bitfield that control the record.
BitHexDescription
00x01Fixed pitch - Instrument always plays the same note. Most MIDI instruments play a note that is specified in the MIDI "key on" event, but some (most notably percussion instruments) always play the same fixed note.
10x02Unknown - used in instrument #65 of the Doom GENMIDI lump.
20x04Double voice - Play two voices simultaneously. This is used even on an OPL2 chip. If this is not set, only the first voice is played. If it is set, the fine tuning field (see below) can be used to adjust the pitch of the second voice relative to the first.
21Fine 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.
31Note number used for fixed pitch instruments (see below)
41Modulator Tremolo / vibrato / sustain / KSR / multi
51Modulator Attack rate / decay rate
61Modulator Sustain level / release rate
71Modulator Waveform select
81Modulator Key scale level
91Modulator Output level
101Feedback
111Carrier Tremolo / vibrato / sustain / KSR / multi
121Carrier Attack rate / decay rate
131Carrier Sustain level / release rate
141Carrier Waveform select
151Carrier Key scale level
161Carrier Output level
171Unused
18-192Base 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-3516Second voice, same layout as 4-19.
  • OPL3 Bank Editor - a utility that allows the editing and creation of own GENMIDI banks.
This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.