Page 1 of 1

id Software was Lazy - DOOM could have had PC Speaker Music!

Posted: 2025-12-02
by minki
I'm guessing everyone here has played DOOM before, or at least seen someone else play the game.
It would also not be of any news for most here, that DOOM has specific hard-coded sound drivers which directly talk to the sound hardware.
Now, many PCs didn't have a dedicated (let alone supported) sound card for DOOM. What people often overlook is the PC Speaker driver that DOOM comes with. Mostly as it can only play back sound effects (and does so quite poorly too). Many times, it ends up disabled rather than being used.
For a long time, it has been speculated that the PC Speaker driver never supported audio as it would have been too resource intensive to drive the interface in real-time while performing game logic. Now, on a 286, I would totally understand this reasoning, but on a processor as fast as a 486? No chance it wouldn't work!

Introducing: The PC Speaker sndserver patch!
I had decided that the only way to answer the question of if, was to try it. And try it I did:
https://youtu.be/bRHyQPhA_9A

A few weeks ago, I had written a file format for efficiently playing PC Speaker tunes on a 32-bit system, requiring only a few integer operations to turn the data into a valid call for the input/misc/pcspkr device. The format being called pcsp and working as follows:
A song is made up of an array of 32 bit tone cells consisting of
- a 16 bit frequency value in Hz
- a 4 bit duration scale (second*10^-scale)
- a 12 bit duration value

Now, all I really had to do to get PC Speaker music working in DOOM, was to implement a priority mixer for it in sndserver.
The ground work for which already existed in the existing Adlib target.

Surprisingly, running the game with and without the patch showed no noticeable speed differences.

Will this patch become public? Yes, soon.
I do not feel comfortable with publishing it yet as I currently only have the E1M1 soundtrack implemented and also would like to fix a few other issues with the sndserver on modern Linux while I have the chance.