GENMIDI
From Doom Wiki
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.
Contents |
[edit] Lump format
[edit] Header
The lump has an 8-byte ASCII header, containing the text "#OPL_II#".
[edit] 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:
| Offset | Size (bytes) | Description |
|---|---|---|
| 0 | 2 | Flags (see below). Little endian. |
| 2 | 1 | Fine tuning - This normally has a value of 128, but can be adjusted to adjust the tuning of the instrument. |
| 3 | 1 | Note number used for fixed pitch instruments (see below) |
The flags value is a bitfield containing several flags that control the record. These are:
| Bit | Hex | Description |
|---|---|---|
| 0 | 0x0001 | Fixed pitch - Instrument always plays the same note. Most MIDI instruments play a note that is specified in the MIDI file, but some (most notably percussion instruments) always play the same fixed note. |
| 1 | 0x0002 | Unknown - used in instrument #65 of the Doom GENMIDI lump. |
| 2 | 0x0004 | Double voice - Play two voices simultaneously on an OPL3 chip. If this is not set, only the first voice is played. |
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 on an OPL3 chip; otherwise, only the first set of voice data is played.
The voice data has this format:
| Offset | Size (bytes) | Description |
|---|---|---|
| 0 | 1 | Modulator Tremolo / vibrato / sustain / KSR / multi |
| 1 | 1 | Modulator Attack rate / decay rate |
| 2 | 1 | Modulator Sustain level / release rate |
| 3 | 1 | Modulator Waveform select |
| 4 | 1 | Modulator Key scale level |
| 5 | 1 | Modulator Output level |
| 6 | 1 | Feedback |
| 7 | 1 | Carrier Tremolo / vibrato / sustain / KSR / multi |
| 8 | 1 | Carrier Attack rate / decay rate |
| 9 | 1 | Carrier Sustain level / release rate |
| 10 | 1 | Carrier Waveform select |
| 11 | 1 | Carrier Key scale level |
| 12 | 1 | Carrier Output level |
| 13 | 1 | Unused |
| 14 | 2 | "Base note offset" (unused?) |
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).
[edit] 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.
[edit] Use in modern ports
Most modern operating systems do not provide the ability to program the OPL chip directly; indeed, many modern computers may 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.
[edit] External links
- Page with the GENMIDI file format for download
- SBI file format, which is similar to the GENMIDI instrument data.
Categories: WAD lumps | Audio | Lists


