ISTR reading somewhere recently that audio CDs and CD-ROMs are encoded differently, such that CD-ROMs are more resistant to (or more able to correct) read errors. Is this true? If so, how is it done, and why isn’t it done with audio CDs?
The simplest question there is why it isn’t done with audio CDs. If an audio CD fails to correct an error, then the worst that’ll happen is that it’ll sound slightly wrong for a moment, and then go back to what it should be. And trying too hard to fix errors costs time, especially on the hardware available at the time that audio CDs first became available, which could mean a greater interruption of the listening experience.
As for how it’s done, there are many ways to make error-correcting codes, depending on how complicated you want to get, how much data you’re encoding at a time, and what sorts of errors (or combinations of errors) you expect to show up. The simplest (but least efficient) is to just repeat the entire message three times: At any given bit, if the three copies disagree, use the one that two of them agree on, because it’s unlikely that two of them would have errors at the same spot.
But there are more efficient ways. For instance, you can encode four bits using seven, in such a way that an error in any one bit (including the three extra you added) can be detected and fixed. Imagine drawing a three-circle Venn diagram. Put your four original bits in the four intersection regions. Now, for the three non-intersection regions, put either a 1 or a 0, to make the total number of 1s inside that circle an even number. When you get the message, if all of the circles contain an even number of 1s, then all is well; the message arrived correctly. If some of them don’t, then you can tell by which circles are odd which bit must have been changed (and thus change it back).
This can actually be generalized to larger chunks of data, for which it gets much more efficient: The number of extra bits that must be added scales with the log of the number of original bits. But that’s only for correcting one bad bit at a time. What if you can have a group of bits next to each other that all get mangled (say, from a scratch on the CD)? What if there’s a possibility of digits getting swapped? What if there’s a possibility of a bit being removed entirely (so the message continues with the next bit, shifted into its place), or of an extra bit being squeezed in? For all of these cases, codes can be and have been designed.
Bits on a CD-ROM are more important. If just a few of them are wrong, they can cause the entire program to be bad.
A few bad bits on on an audio CD is no big deal.
I would assume it’s even worse than that. Even if one is wrong, that can completely break a program.
Both audio and data (e.g., CD-ROM) CDs use error correction codes. Reed-Solomon being the key one. But the encoding is done very differently.
For audio CDs (Red Book standard), the error correcting bits are part of the music’s actual bit stream. It is also set up so that if some bits are bad, there is interpolation done to “fill in” the missing bits to approximate the sound. So the music tends to degrade gracefully as the CD gets scratched or whatever. The drive can’t read the music without also reading the error correcting bits.
For data CDs (Yellow Book standard), the error correcting bits are in a separate chunk from the the data bits. So the drive reads some data bits, reads some error correcting bits, checks and fixes if necessary and moves on. If you wanted to, you could make a CD reader that read only the data bits and never the error correcting bits. (And take your chances.)
The advantage of the audio style standard is the number of bits that are buffered at one time are fairly small. So the hardware requirements of the early 80s were doable. Later, when the hardware got cheaper, it was possible to buffer more bits at one time so a better (IMHO) method was used. It can correct for a more concentrated group of errors in a sector better. Which a cross-wise scratch-type defect is more likely to cause. So “graceful degradation” on a data CD is not a thing. It can handle a modest amount of errors well and then … it can’t.
Here’s a great video on how audio CDs work focusing on the hardware and low-level data encoding.
It’s part of a five-video series on digital audio which is absolutely wonderful for the beginner.
And what type of error matters, too. A straight scratch that goes across multiple sectors is better than a circular scratch.
Though do note that the data portion of a regular CD-ROM (But not CD-Rs or CD-RWs) is near the top layer, and so there’s a lot of room to buff out a scratch.
Correction: The data layer of both CD-Rs and CD-RWs are at the same location as any audio or CD-ROM - just under the label side of the disc.
That’s why I specifically mentioned a crosswise scratch as being a “good” one, correctability-wise.