DMX was a sound library written by Paul Radek of Digital Expressions, Inc., which was used in the Doom engine to provide sound and music playback under DOS. This library initially was written for Cygnus Studios to power audio for their games The Second Sword and Raptor: Call of the Shadows.
- PC speaker sound effects support.
- GSS support for MIDI sound effects.
- Support for Gravis Ultrasound and Sound Blaster compatible sound cards for stereo digital audio output on up to 8 channels.
- Support for General MIDI, Gravis wavetable, and Ad Lib-compatible OPL music playback, with a special option for OPL3.
- Up to two music files can be played simultaneously, with volume fade-in/out effects.
- Primitive support for analog surround sound with phase-shifted stereo output.
Use in Doom
References to DMX can be found in Doom (although not in the game directly): a DMXOPTION environment variable allows a couple sound options to be set, and the DMXGUS lump contains instrument mapping data for use on the Gravis Ultrasound card.
DMX supports its own native sound effect formats, two of which are used in Doom: format 0 is used for PC speaker sound effects while format 3 is used for digitized sounds. Formats 1 and 2 are reserved for MIDI-based sound effects, known in the DMX library as GSS. DMX can also play Microsoft WAVE format effects, but Doom does not use the API required for it.
Up until the version used in Doom v1.5, DMX only accepted MUS-format music lumps. After that point, it integrated its own MIDI-to-MUS converter. However, due to the conversion process, MIDIs to be played back in this manner are subject to all of the limitations of the MUS format - in particular, they must not exceed 64 KB in size after the conversion, nor can they utilize more than nine channels.
Historical records imply that id Software was dissatisfied with the DMX library in retrospect. John Romero was quoted in a 1994 alt.games.doom newsgroup post calling Radek a "shithead," a "sound code dork," and "incompetent." John Carmack described the use of DMX as "a mistake" in the 1997 release notes to the Doom source code.
Probably prompting the above, several features of DMX broke and then were fixed during Doom's development, including spurious issues with high IRQs and temporary loss of support for the Ultrasound altogether. A change to the API of the SFX_PlayPatch function also led to the loss of random pitch variation for sound effects, though id Software's coders share blame for this problem.
The use of this external library meant that when the Doom source code was later released, only the source code to the Linux port could be made public, as disclosure of the copyrighted DMX APIs could have resulted in an infringement lawsuit; either Radek was unwilling to agree to the release of his code, or id was uninterested in attempting to negotiate at all.
Despite id's unwillingness to release any DMX-related code, Raven took a much more relaxed attitude to the issue, and DMX-related code was included with the Heretic and Hexen source releases, although not the DMX library itself. As a result, neither of those games can be compiled "out of the zip," and must have these calls commented out or replaced with an equivalent library.
- Though OPL3 is specifically supported in later versions of DMX, the stereo channels are reversed. This is thought to be due to Radek having owned a Sound Blaster model which had this problem.
- The channels of MUS and MIDI songs have their velocities clipped to the current music volume setting, rather than scaled by it with a multiplicative operation as would be the usual approach. As a result, the relative volume of channels can change as music volume is adjusted downward, with louder instruments decreasing in volume first until they match more quiet ones, and, in contrast when moving up, channels with a base volume level lower than the setting will not become any louder. This in turn had strange implications for the track Smells like Burning Corpse in Final Doom TNT: Evilution, where a track with an invalid out-of-range volume level of 128 is always clipped to 127, since 127 is the maximum volume setting allowed. When the song is converted or played back by tools unaware of this problem, it sounds distorted as a result.
- When a MIDI is converted to MUS through DMX, there is a noticeable pause when the MIDI sequence loops.
- Hardware mixing on the Gravis Ultrasound was replaced with software mixing after Doom version 1.2 due to a bug with frequent Direct Memory Access calls causing occasional lockups.