PC speaker sound effects

When Doom was released, digital sound cards had not yet become as ubiquitous as they now are. Therefore, a large number of the computers playing Doom did not have sound cards. As a workaround for this, id Software included two sets of sound effects: alongside each of the digital sound effects that are played on sound cards, there is an equivalent PC speaker sound effect that plays through the PC speaker found on all PCs.

While digital sound effects have the prefix "DS" inside the Doom IWAD, PC speaker sound effects have the prefix "DP". For example, the sound of a pistol firing is stored in the lump named "DSPISTOL"; the corresponding PC speaker sound effect is named "DPPISTOL".

The format is notable in that it was the last WAD lump format to be properly decoded and understood. The Doom source code release did not include the PC speaker code, as it was part of the proprietary DMX sound code that was removed from the source code before its release (evidence of this can be seen in the Heretic source code). As PC speaker sound effects were no longer necessary by this time, little effort was made in properly determining the format.

The format was finally properly reverse-engineered in 2007 by Andrew Apted and Simon "Fraggle" Howard.

Format
PC speaker sound effects have a four byte header that is used to specify the length of the sound. That many bytes then follow.

Each byte corresponds to a tone that is played for 1/140th of a second (this corresponds to 4*35, where 35 is the number of frames per second in Doom). The frequency values used are on a musical scale; there are 24 notes per octave, which corresponds to double that of the western musical scale (12 notes per octave). The values are therefore a superset of the western musical scale, with an extra microtone inserted between each note.

Because of this, the frequencies increase exponentially with respect to the byte values. Adding 24 to the value doubles the frequency. A value of 0 causes silence.