DMX

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.

Features

 * PC speaker sound effects support.
 * GSS support for MIDI sound effects.
 * Support for, , and compatible sound cards for stereo digital audio output on up to 8 channels. Output was strictly at a sample rate of 11025 Hz up until the version of the library utilized in Doom 1.4, at which point it was upgraded to 22050 Hz.
 * Support for General MIDI, Gravis wavetable, and OPL music playback, with a special option for OPL3 (reversed stereo).
 * Primitive support for analog 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 only 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 unknown, though reverse-engineering efforts showed that they do exist as there is a function dedicated to handling them both.

Up until the version used in Doom v1.5, DMX also 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.

Problems
Various sources imply that id Software's programmers were dissatisfied with the DMX library. John Romero was quoted in an alt.games.doom newsgroup post as having called Radek a "shithead", "sound code dork" and "incompetent". John Carmack later described the use of DMX as "a mistake" in the 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, temporary loss of support for the Ultrasound altogether, and total permanent loss of support for pitch bending of sound effects after the sample rate upgrade.

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

The only known non-Doom-engine game to have used the DMX library is Raptor: Call of the Shadows by Cygnus Studios.

Other bugs

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