OPL synth emulation
ZDoom's OPL emulator replicates Yamaha OPL2 or OPL3 chips. It is the one of software synthesizers offered by ZDoom which does not use sound fonts. While the Doom music, for example, was composed on and for a Roland Sound Canvas, most gamers at the time had a more affordable Sound Blaster card and the OPL emulator can seem "more authentic" (or at least more nostalgic) for them because of this. Doom was one of the relatively rare games which included instructions for the OPL registers (contained in the GENMIDI lump), allowing to tweak the OPL's output to make it as good as it could be despite its inherent limits.
The vanilla Doom engine supported OPL2, and by default used OPL3 as if the OPL3 chip were two OPL2 chips. One could enable support for OPL3 features, notably stereo output, but the method to activate this support was obscure and poorly documented one had to create an environment variable named DMXOPTION (the manual incorrectly said DMXOPTIONS) and setting it to a value containing the string -opl3. In ZDoom, OPL-specific options can be edited from the advanced sound options menu.
The OPL core emulates a number of OPL chips. ZDoom extends them with features that did not exist on the emulated hardware, notably full MIDI stereo panning (OPL2 is normally mono, and OPL3 limited to 3 panning positions), though such enhancements can be turned off from the advanced sound options menu. There are four different cores available:
- MAME OPL2
- This OPL2 core comes from the MAME project. It is available under the GNU GPL. This core is the oldest present in ZDoom and the default choice.
- DOSBox OPL3
- This OPL3 core comes from the DOSBox project. Note that DOSBox features two different OPL emulators: one (dbopl.cpp/h + adlib.cpp/h) is available under the terms of the GPL, while the other (opl.cpp/h) is derived from Ken Silverman's ADLIBEMU and available under the terms of the GNU LGPL; ZDoom uses the latter.
- Java OPL3
- This OPL3 core is a C++ port of "That Vintage Tone", Robson Cozendey's OPL emulator written in Java.
- Nuked OPL3
- This OPL3 core was contributed by Alexey Khokholov.
Advantages and drawbacks
- Despite the GENMIDI lump's best efforts, OPL synthesis does not sound like real musical instruments.
- Although the emulation of the OPL chip's inner working is bit-accurate, the output can still differ because it has to be resampled to be mixed with the rest of the audio, and OPL chips used a very nonstandard sample rate of 49716 Hz. Further, many of the cheaper sound cards did not use actual Yamaha OPL chips, but compatible clones that differed slightly. Finally, several sound cards applied additional filters to the output of the OPL chip to achieve various effects.