id Software 很懒 – DOOM 本可以有 PC 扬声器音乐
DOOM could have had PC Speaker Music

原始链接: https://lenowo.org/viewtopic.php?t=45

这篇帖子详细介绍了一项关于经典游戏《DOOM》的有趣发现。虽然《DOOM》以其针对专用声卡的声卡驱动程序而闻名,但它也包含一个很大程度上未使用的PC扬声器驱动程序——即使在更快的486处理器上,也常常被认为对音乐播放来说资源消耗过大。 一位开发者挑战了这一假设,并创建了“PC Speaker sndserver补丁”来启用通过PC扬声器的音乐。该补丁利用一种新设计的“pcsp”文件格式来高效播放旋律,成功地将音乐集成到《DOOM》中,而没有明显的影响性能。 目前,只有E1M1的配乐被实现,开发者计划在公开发布之前,完善sndserver以实现与现代Linux的兼容性。这个项目证明了PC扬声器*可以*处理《DOOM》中的音乐,为游戏解锁了一种以前未被探索的音频可能性。

一场 Hacker News 的讨论围绕着一项最近的技术成就:在 DOOM 中成功使用 PC 扬声器实现音乐。虽然令人印象深刻,但评论员普遍认为 id Software 没有选择包含 PC 扬声器音乐,并非出于懒惰,而是出于一项刻意的设计选择。 普遍的观点是,PC 扬声器的音质有限,会与 DOOM 旨在营造的黑暗和沉浸式氛围产生冲突。此外,早期的尝试可能导致游戏体验受到干扰——演示的实现会在音效时暂停音乐,这与像 AdLib 这样的声卡实现的更流畅的混音不同。 评论员指出,id Software 以其高强度的工作态度而闻名,并且也考虑过(并拒绝了)其他低保真音频选项,例如 Disney Sound Source,原因类似。 普遍的信念是,他们优先考虑音质和玩家体验,而不是技术可能性。
相关文章

原文
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.

联系我们 contact @ memedata.com