Quake CD Audio
Story Time!
So this trip down the retro rabbit hole takes us back to 1996’ish. Quake has been released and proceeded to consume unknown countless hours of my CPU and GPU cycles.
The Quake Shareware CD-ROM was interesting in that in addition to the shareware/demo release, it included the full version of the game in addition to the rest of ID’s catalog at the time. Another feature of the Quake CD (like many 90’s games) is that they were pressed as mix-mode CDs and supplied the soundtrack through traditional CD audio encoding as which you could play through your traditional Audio CD player. The soundtrack, and I believe sound effects, were created by Trent Reznor & Nine Inch Nails.
The problem
In computers of the time, your computer would have a dedicated audio cable that went from your CD directly to your sound card, and the CD would just play the appropriate track.
In revisiting Quake in the modern (2021) world, CD/DVD players are rare to find in both laptop and desktop computers. Fortunately, we have a number of source ports, and several of these support playing CD audio, as well as playing encoded audio files directly from the file system. So, our task is to extract the CD audio and encode them in a usable format with a bonus of encoding them to OGG as to not be wasteful with our megabytes.
The process
We’ll rip the audio from the CD using CD Digital Audio (cdda) extractor called “cdparanoia”.
Install the package if needed.
`#> dnf install cdparanoia`
Interrogate CD for layout and audio tracks
`#> cdparanoia -vsQ`
extract CD content to WAV format
`#> cdparanoia -B`
Pre-Emphasized Content
Mini-story time: CD Audio content in the early-mid 90’s was preemphasized. The gist as I understand it is that Audio was EQ tweaked so that it would sound correctly on early generation CD Audio players. The result today is that the raw tracks have a higher trebel range and, without additional processing, isn’t what the original artist intended. Community consensus is that the Audio Tracks included on the Quake Shareware Disk were Pre-Emphasized. To make it sound as intended, we’ll need to run a filter to de-emphasize the audio tracks.
De-Emphasize
Luckily there’s a program called SoX that can easily take care of this for us.
`find . -name '*.wav' -exec sox {} {}.deemph deemph \;`
The result is a new version of our wav files in the format track10.cdda.wav.deemph.wav
Re-encoding audio
So this is dependant on the source port you’re using and its audio format support and expectations. In the case of DarkPlaces, it supports OGG & WAV, so we may want to save drive space by encoding our files to OGG.
On Fedora, you’ll need vorbis-tools to provide oggenc
`dnf install vorbis-tools`
Next up, encode your files. Check the oggenc man page if you want to up the quality, or work with any other tunables.
`oggenc *.deemph.wav`
Cleaning up our mess and placing files
So what the software really wants is audio in the format of “track##.ext”, and all of our processing has created a bit of a naming mess. If you’re following along, you’re currently looking at files in the form of ’track##.cdda.wav.deemph.ogg'
We can clean this up with some script-fu.
#!/bin/bash
for file in *.ogg; do
mv "$file" "${file/cdda.wav.deemph./}"
done
Off to the races
Now copy all those track##.ogg files to ~/.darkplaces/id1/music
and you’re all set. Next time you launch Quake (darkplaces) you’ll have the amazing soundtrack to frag to!