23

I have been digitizing the audio tracks from various old CDs lately, because I have become a lossless audio snob who no longer is able to tolerate MP3s but need FLACs of everything. Many of these are not music albums but rather CD-ROM-era video games, mostly for consoles.

Many CD-based games regardless of platform seem to have a "data track" first, containing all of the game's code and assets, and then have the rest of the disc filled with actual audio CD tracks, which can be extracted or listened to on any CD player. The game presumably executes some code such as "please play track #3 now".

It strikes me that this might not be desirable in all cases. It's basically like having all your adventure game items as separate PNG images for the player to snoop at freely, rather than baking them all into a cryptic (but not necessarily "secure") file called game.dat or something. Basically, discouraging cheating/spoiling of the experience.

For example, I used to be puzzled when I listened to my copy of DOOM for Sega Saturn with a normal CD player, and heard that "Club Doom" rave song which is supposed to be a secret that you can find in the game (it's a special level). But now I heard it just from "digging around" on the disc, so I destroyed the surprise.

Is there anything that technically or practically prevented them from "hiding" all the CD-quality soundtrack in one or more "data tracks"? Did the CD format dictate that you MUST make standard CD audio tracks for any song to be played from your game? Maybe it was related to performance/limitations?

13
  • 14
    At a guess mixed mode CDs offered far higher quality sound, and the audio tracks could be played without much CPU overhead, as opposed to having to decode CD quality sound from data files while running the game as well.
    – Alan B
    Commented Dec 6, 2022 at 14:41
  • 15
    Nothing stops you from keeping audio tracks as regular files in the data part, but that precludes using the CD drive’s native playback functionality, as described in <retrocomputing.stackexchange.com/a/25625/15334>. Commented Dec 6, 2022 at 14:43
  • 3
    @zomega this is explicitly documented in the MMC spec (page 29): audio playback only works inside audio tracks. Commented Dec 6, 2022 at 15:19
  • 2
    @zomega not just SCSI drives, CD drives in general use the SCSI MMC command set. Commented Dec 6, 2022 at 15:40
  • 6
    @zomega this is veering off-topic, but ATAPI is SCSI over ATA. (AHCI is a spec for host controllers, not drives, and doesn’t determine the command set.) Commented Dec 6, 2022 at 16:08

6 Answers 6

34

The various CD specifications dictate how specific types of tracks can be laid out on disc, but they don’t say that all audio must come from an audio CD track.

There are other considerations however, including:

  • encoding audio as an audio CD track, as you surmise, allows it to be played back by asking the drive to play the track; playback then happens with no overhead (other than keeping track of what is being played, if necessary)
  • while an audio CD track is being played back, nothing else can be read from the CD
  • streaming data from CD takes some effort and isn’t really viable on early CD drives (see the lengthy load times when changing levels on some PlayStation games)
  • preparing audio CD tracks for mastering was a well-known process in the 90s, preparing audio in other forms requires more coordination
  • playing audio CD tracks involves some latency (especially when switching tracks)
  • audio CD tracks aren’t space-efficient
  • on some platforms, audio CD provides better-quality audio than the rest of the system’s hardware is capable of
  • audio CD playback is usually set up as a separate channel and can be mixed as necessary with the rest of the audio being produced

Thus audio CD tracks are more appropriate for background audio than for effects (although some games did try using audio CD tracks for the latter). They are also only appropriate for games where no data needs to be loaded during gameplay.

So audio CD tracks in games were relevant during a specific time window: when games were still small enough that meaningful amounts of data (e.g. a complete level) could be stored in memory, and that the room used up on a CD by the game’s music left enough room for the game’s data, and when the available processing power was too limited to make decoding compressed audio a viable option. Especially as processing power increased, game publishers moved away from audio CD tracks and towards compressed audio stored in the game data.

Data tracks and audio tracks are quite different on CD, which precludes storing audio as a special file in a data track and having the CD player handle that. Audio playback can be started from an arbitrary location on a CD, but that location has to be inside an audio track (see the MMC command specification, page 29). Some platforms supported CD-ROM XA to allow interleaving audio, video, and data, but I don’t know whether that was actually used all that much.

Modern re-publication of old games often does not include the audio CD tracks (see e.g. Quake on Steam, at least initially), and many game players aren’t even aware that they’re missing out by not benefiting from the audio CD tracks (including game players back when all this was state-of-the-art, at least on PCs, since CD-ROM drives weren’t always connected properly for audio playback).

11
  • 1
    The first episode of Wipeout on the PSX is quite interesting, on version 1.0 (there are two versions actually), not only the audio are audio tracks but they are also visible on the data track and can be copied (.SWP files); wondering how they actually achieved this.
    – aybe
    Commented Dec 6, 2022 at 21:19
  • 1
    @RogerLipscombe but you can start at arbitrary points in a track to get round that
    – Chris H
    Commented Dec 7, 2022 at 16:59
  • 1
    @aybe: The ISO9660 filesystem doesn't require that the data for a file is on the same track as the metadata. So, you can have a file entry in the ISO9660 filesystem which points at the first block of the audio track. Commented Dec 7, 2022 at 19:54
  • 1
    @JörgWMittag Why would a file system which is on a data track would say it has a data file but point outside the data track into an audio track? They are not compatible even at sector level.
    – Justme
    Commented Dec 7, 2022 at 22:01
  • 1
    @Justme What's interesting is that you can copy the files from Explorer and Windows will actually add a RIFF header to it! Forgot the exact name but you can attempt to extract a sector in whatever mode you'd like to, Windows probably does that. You can find the exact details in CD Cracking Uncovered: Protection Against Unsanctioned CD Copying (Uncovered series) by Kris Kaspersky.
    – aybe
    Commented Dec 7, 2022 at 23:38
17

You can't direct a CD player to play audio directly from a data track, because the formats are different. You can read CD-quality audio from the data track and play it through the speakers, but that requires the CPU to do work.

For some background, see "How do I put audio and data on the same CD?". Putting data in track 1 and audio in tracks 2+ is a common approach, but creating a multisession disc (audio in the first session, data in the second) can also work. Neither approach hides audio tracks, though CD-ROM drives will generally focus on the last session unless you direct the software otherwise. (Some copy-protected audio CDs relied on this.)

Tangentially, there's a fun trick you can use to hide things. From "How do I put "hidden tracks" and negative indices on audio CDs?":

With a little searching you can find an audio CD that will cause your CD player to show a negative track time when one track finishes and the next begins. The negative sections are usually filled with silence, but some rare discs will have material in them. If you seek directly to the track, you don't see (or hear) the negative-time section.

You can specify the start position of an audio track anywhere within the track. The start position is at time index 00:00 (in minutes and seconds, MM:SS), so the music before the start point is usually displayed with negative time values. When you seek directly to a track, the player jumps to time index 00:00, but when you play through from a previous track you hear the entire track.

[...] It should be mentioned that the only truly "hidden" track is in track 1.

So you could hide the "easter egg" music inside the pre-gap of track 1, and somebody playing the disc in a CD player might not notice it's there.

5
  • 3
    I thought the purpose of such silence periods was to allow for the possibility that a player might lose tracking between the end of one track and the start of the next. On a couple of my audio CDs, holding them up the light reveals rings that are differently reflective, in a manner analogous to the inter-program regions on vinyl records, and I think some disk mastering approaches operate in track-at-once fashion which would create discontinuities in the recorded data patterns at track boundaries.
    – supercat
    Commented Dec 6, 2022 at 23:28
  • 1
    The pre-gap can be whatever you want it to be; like the tracks themselves, it's just numbers in a cue sheet and PQ subcodes. Recordable CDs have a physical groove in the media, so I'm not sure why tracking would be lost. You will have small gaps between tracks with track-at-once recording, for the run-in/run-out areas, which are usually silent but would sometimes cause a click. That's one of the reasons why disc-at-once (or session-at-once) became the default.
    – fadden
    Commented Dec 7, 2022 at 6:02
  • I wonder why some audio CDs have a pattern of rings that looks like an LP vinyl record? It's certainly not for the benefit of any human who would be trying to cue a player to the right spot (which would be the purpose of such rings on an album).
    – supercat
    Commented Dec 7, 2022 at 8:48
  • @supercat: e.g. fadden.com/tech/cdrpics/data-surface-2.jpg ... I have some guesses, but never did get a definite answer.
    – fadden
    Commented Dec 7, 2022 at 16:09
  • I guess silence periods could be used to produce 'mixed album' with smooth transitions between audio tracks, but when you want to listen a single track, it's played without such intermediate mixed parts.
    – user11153
    Commented Dec 7, 2022 at 17:13
7

I don't think any current answers highlight that the PCs of the day, didn't have the processing power to read a PCM file (or compressed file), decode them, and play them through the sound card connected to the speaker(s) (if there even was one) AND generate the graphics to play a game, at the same time!

Back in the 90s, CDROMs came with a headphone socket, so you could directly hear the CD sound, without having to use the CPU to play it. CDROM drives also had a physical wire, to directly connect to your sound card, so the sound could be played directly from the drive and out of your external speakers, (again without a CPU being involved, apart from choosing which track to play).

2
  • 1
    I tried to include that in my answer: “when the available processing power was too limited to make decoding compressed audio a viable option” (PCM isn’t a concern really, games with CD audio routinely used PCM sound effects as well). Your second paragraph is covered by retrocomputing.stackexchange.com/q/25623/79. Commented Dec 7, 2022 at 17:07
  • My CDROM drive(s) had track buttons and a volume adjustment as well. I once jumpered a spare PSU connected only to a spare CDROM drive to use as a stand-alone CD player. Speakers hooked to the headphone jack.
    – Yorik
    Commented Dec 7, 2022 at 21:48
6

CDs were designed for audio, and when they created the CD-ROM standard, they shoehorned the data storage into the existing audio CD format, essentially disguising the data as audio (which would play back as horrible white noise on a non-CD-ROM-aware audio CD player).

44.1 kHz, 16-bit, stereo PCM audio takes 176400 bytes per second, or 2352 bytes per 1/75 of a second. The CD-ROM standard uses 2048 of each 2352 bytes for one sector of data, and the other 304 bytes for headers and additional error correction (on top of the error correction that was already in the CD-audio standard).

The "tracks" on a CD were just a list of time offsets stored in the disc table of contents; CDs really just have one continuous spiral track like vinyl records. In principle, you could have a region listed in the TOC as a data track, with a filesystem containing a large file named game.dat, and within the sectors nominally occupied by that file have not CD-ROM data, but CD audio that could be played directly by the drive as though it was in an audio track.

However, according to Stephen Kitt's research with actual drives (see his comment), the drives checked the starting time against the TOC and refused to play if it was inside of a data track. So it wasn't actually possible.

Video CDs used a similar scheme: they contained "files" whose sectors were in a special format that contained more than 2048 payload bytes. To play or extract data from these discs, you had to bypass the filesystem and issue low-level read commands to the CD-ROM drive. I don't know whether the drives would let you read raw CD audio from a data track in that way; but even if they did, you would have to feed the audio to the sound card by hand, and would lose the benefit of background playback.

5
  • 4
    Fun fact: even audio CDs have one layer of error correction, outside the 2352 byte sectors. So data CDs add a second level of error correction coding inside that. And yeah VCDs (video CDs) that got something like 800MiB per disc bypassed the L2 error correction like CD audio. Bit-errors in compressed video usually just creates a glitch that goes away by the next keyframe. Commented Dec 7, 2022 at 3:48
  • 4
    I think the main reason is the obvious one - why would you forcefully stop people from listening to the game music? Games with CD-quality soundtracks often took pride in that music. It's not like ripping music from CDs was any easier than extracting it from the game through any other means. All it would accomplish is make the CDs harder to produce (and provide patches, as rare as those were before the internet really got going) . People like to listen to music.
    – Luaan
    Commented Dec 7, 2022 at 7:27
  • 3
    I think Table 6 also concerns PLAY AUDIO MSF, even though the latter’s description doesn’t specifically mention the requirement. I wrote a test program to check this, and attempting to play a data track (or portion thereof) using PLAY AUDIO MSF fails with an “Illegal mode for this track” error on all the drives I have handy (of varying vintages, from 1996 to 2018). Commented Dec 7, 2022 at 7:34
  • 1
    @StephenKitt I think your experiments are definitive since if the trick failed to work on even 10% of common drives, that would be enough to kill it in a shipping product. The TOC only has start times, so overlapping tracks are impossible unless I'm missing something. Perhaps you could make the filesystem reference sectors outside the data track (I think something like that happened with multisession CD-Rs), but if the audio is in an audio track anyway then there's no point.
    – benrg
    Commented Dec 8, 2022 at 0:45
  • @benrg ah yes, I’d forgotten that the TOC only specifies start times. Commented Dec 8, 2022 at 8:18
2

Stephen Kitt has already given you a comprehensive answer as to how CDs work.

I'll answer one question you didn't ask: is there a way to have "CD-audio quality music on a CD-ROM not as an audio track?"

To this question, the answer is yes. Pure wave PCM track wouldn't necessarily make sense, while possible. It would only make sense if you really wanted to hide. But there exist other format, like the venerable MOD, and its descendant. I'm particularly thinking of Unreal and Unreal Tournament here, which had files called "UMX" I think (or was it UXM?). These were, from the top of my head, standard XM ("eXtended Module") files.

Unreal Tournament soundtrack this will give you an idea of the quality. Unreal Tournament was released on CD-ROM, and fitting all the audio tracks as wave PCM wouldn't have together with game data.

Now, if you're trying to fit an orchestra recording into an XM file, you're not likely to be able to do it with the same quality as a audio recording. MODs work well were the amount of samples can be small, and a modern orchestra library ("VST") is often in the 30GB+ of samples.

In other words, you can have 44 Khz 16 bits stereo PCM sound played. That's "Audio-CD quality". That doesn't mean you can have just any soundtrack in XM/alike format with the same sound quality as a recording of a real band.

0

A CD may contain mixed content in the form of data and audio tracks. Back when the PC-Engine brought the gaming world into the CD-ROM, the usual format was of an audio track to warn the users to skip track #2. Then followed the data track and every track from the third are audio.

But that does not answer your question.

The question is if a data track in one of those discs may also contain music. And the answer is, definitely yes. First of all you would find all the sound effects that need to be triggered quickly without having to wait the CD to fetch them, you may also find some short PCM but especially in very old games the track may contain an audio driver which controls through an interpreter the synth the system used (for example an OPL) and the equivalent of some sort of tracker data files to feed it which may correspond to both to elements of the soundtrack and the foresaid effects.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .