What happens if a scratched CD is ripped to MP3?

12

5

If a CD is damaged (e.g. if placed in a CD player it would stutter etc.), if you rip it on your computer to create an MP3, how will the damaged data sound?

Would it be just a "blank" in the middle of the track? Or would you hear garbled audio / static etc.?

For clarity this question relates to reading audio from a CD, and encoding to MP3, not reading a data CD that has an MP3 on it.

sam

Posted 2018-04-13T16:19:50.333

Reputation: 3 411

2@AFH doesn't that advice apply to every question ever? Perhaps he doesn't have a damaged CD to try it and doesn't feel like damaging one just to find out. – RyanfaeScotland – 2018-04-13T23:03:53.240

7You don't "burn" an MP3 from a CD. "Burning" refers specifically to writing data to an optical disk of some kind (CD, DVD, BluRay). – jpmc26 – 2018-04-13T23:09:07.897

@RyanfaeScotland - It applies to questions with far too little information to allow a reasonable answer. But I take your point that the question may be hypothetical, though a CD-R costs 10-20p, so it's not exactly an expensive test. – AFH – 2018-04-13T23:22:13.190

@AFH Ha, the idea of burning a CD just to damage to then try and rip again never occurred to me! My collection is safe. – RyanfaeScotland – 2018-04-14T00:05:13.563

Answers

38

Good CD ripper software like cdparanoia try their best to correct bad readings of a CD and will go over the affected part multiple times; sometimes for several minutes until the data is recovered. This is possible because CDs contain checksums for error correction and should detect a misreading straight away.

Due to this strategy, CD ripper software has a much higher chance of recovering the correct data than a typical CD playback device which is designed to playback in real time.

In the rare case that a portion of the data (which would be audio in your example) remains unreadable, the ripper will typically just skip that segment. So with an encoded MP3 file, it will skip the bad section (which could be either interpolated or audibly skipped in the resulting audio file).

ypnos

Posted 2018-04-13T16:19:50.333

Reputation: 596

1@JamieHanrahan While I agree they do error correction, I hope a distinction is made between that and the interpolation, as the interpolation is more akin to imputation, rather than correction. – user1997744 – 2018-04-13T17:08:18.890

1If you're on PC Exact Audio Copy does a similar thing, if there is a scratch or defect in the disc it'll read multiple times. – aslum – 2018-04-13T19:24:23.790

How does going over the affected multiple times recovers data? By chance? – screwnut – 2018-04-13T19:35:21.567

1Yes, pretty much by chance. It isn't effective very often. btw, what happened to my previous comment here? The one user1997744 is replying to? – Jamie Hanrahan – 2018-04-13T19:37:26.423

20@screwnut: A CD Player cannot afford to "go slow". A glitch or silence is much preferable to just stopping the music. When ripping, however, the software can try to read the affected region multiple times. Due to inaccuracies in the servo motors of the drive and other random factors, the laser may hit the area at a slightly different angle or at a slightly different position which may or may not make more data readable. Depending on the user settings, the software may try up to several hours to read the affected area. Of course, what's gone is gone, but sometimes some stuff is readable. – Jörg W Mittag – 2018-04-13T19:47:03.783

@JörgWMittag: From recent experience, if a track is really damaged, 8 hours and more trying to read a few seconds of play time is possible. – emk2203 – 2018-04-14T12:28:53.770

@ypnos do you know which ripper library itunes uses ? – sam – 2018-04-14T14:32:38.333

@sam Sorry, I don't but I expect it to be in-house. It is generally claimed to be less accurate than cdparanoia. – ypnos – 2018-04-14T16:45:08.383

Something to be aware of: CD-DA actually uses quite less error correction, and fits more "payload" bits on the medium, than data CD formats. An audio CD is likely to have SOME defects that players will just interpolate/correct away. – rackandboneman – 2018-04-15T01:08:15.310

3@aslum PC is not a synonym for Windows. Stop implying that. GNU/Linux also can be used on a PC and is often used that way. – Display Name – 2018-04-15T07:55:52.173

@rackandboneman IIRC the original specification for CD error correction would in principle allow for drilling a little hole somewhere, so way more than a mere scratch – Hagen von Eitzen – 2018-04-15T08:29:02.217

14

The MP3 file format consists of frames. Each frame starts with eleven "1" bits and also a couple bytes of metadata controlling the bit rate and defining some other attributes. Each frame is independent, it was designed this way to support streaming.

Frames can have a CRC - an error check. It's optional.

The operating system will likely retry reading if it encounters bad sectors on a CD (CD hardware has its own error checking mechansim before the MP3 encoder even sees anything). Assuming the decoder is not working off of a buffer, the decoder won't receive new data during this process and will have to stop. If the operating system can't read the data, it may report an error to the operating system, which will eventually be reported to the process hosting the MP3 encoder. Depends on the software what happens exactly here.

A couple of possible things can happen if the data from CD is read incorrectly and still makes it to the decoder (this probably would not happen on a PC but could in a car stereo or other non-PC device):

  • An MP3 decoder looks for those eleven 1 bits to find the start of a frame - if it doesn't find them it will probably stop decoding until the next frame.

  • If the header data is bad, it may play the frame at the wrong bitrate since the byte indicating which bitrate may be wrong.

  • If the header CRC bit is set and the CRC doesn't match, the decoder will probably throw the frame out and not play it. Most MP3 files don't have the CRC bit set.

  • If the payload (data after the header) is wrong, the MP3 decoder will try to play it.

A decoder's job is to take the compressed data and generate uncompressed data to hand over to an "upper" level. That upper level actually uses the uncompressed data to drive an audio device. I would hazard to guess most encoders/audio driver setups have a buffer - with a configurable size - where the MP3 decoder can build up some data for the audio driver and allow retrying of reads.

So, anyway, if the decoder has stopped because it's not getting data, the upper level actually driving the audio might do any of the below:

  • Upper level outputs silence. You would hear a break in the audio.
  • Decoder stops filling data into an audio buffer, but upper level continues playing what is there. Audio buffers are typically "circular" which means they are not zeroed out but constantly overwritten with new data. You will hear a skip which is a portion of the previous audio playing.
  • Upper level is smart and tries to interpolate what "should" be there. I don't think this is very common.

If the decoder outputs bad data, you will hear static or pops in the audio.

Reference.

LawrenceC

Posted 2018-04-13T16:19:50.333

Reputation: 63 487

9I think the question is about reading an audio CD, and encoding to MP3, not reading a data CD that has an MP3 on it. – Attie – 2018-04-14T09:30:48.967

1@Attie correct i will update the original question to clarify – sam – 2018-04-14T14:30:23.623

Seems simple enough. – Andrew – 2018-04-14T16:21:05.847

3

In the best case, the ripper manages to retrieve enough data that the track plays just fine. In the second best case, it gives up and doesn't produce an audio track because it cannot. In the worst case, you get an audio file which sounds like when you attempt to play the track in a regular CD player or even worse (pauses, repeats, stuttering, blips, etc).

My experience with cdparanoia-based rippers has generally been mainly best-case, but I've encountered all three scenarios.

tripleee

Posted 2018-04-13T16:19:50.333

Reputation: 2 480

1To be fair to the ripping software, the reason the "worst case" sometimes happens is that for sufficiently small amounts of bad data, it's better than the "second-best case". I'd rather have an mp3 or flac with one pop on it, or a short series of pops, than nothing. And I'd rather have nothing than a track with pops throughout. But the ripper doesn't know how high my standards are. – Steve Jessop – 2018-04-13T19:22:18.240

0

I've never had one with static. Nor exactly "garbled" - but it might play the same half a second for a few times. That's usually right before it skips several minutes before hand to repeat a loop, or skips ahead and sounds like you're holding the FF button for a moment. Any "blanks" are probably it playing the start of a track, as it skips or loops again.

Mazura

Posted 2018-04-13T16:19:50.333

Reputation: 241