What happens if a scratched CD is ripped to MP3?

5,937

Solution 1

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).

Solution 2

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.

Solution 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.

Share:
5,937
sam
Author by

sam

Updated on September 18, 2022

Comments

  • sam
    sam over 1 year

    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.

    • RyanfaeScotland
      RyanfaeScotland about 6 years
      @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.
    • jpmc26
      jpmc26 about 6 years
      You don't "burn" an MP3 from a CD. "Burning" refers specifically to writing data to an optical disk of some kind (CD, DVD, BluRay).
    • AFH
      AFH about 6 years
      @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.
    • RyanfaeScotland
      RyanfaeScotland about 6 years
      @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.
  • user1997744
    user1997744 about 6 years
    @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.
  • Lionize
    Lionize about 6 years
    To 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.
  • Nick Hopkins
    Nick Hopkins about 6 years
    If 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.
  • screwnut
    screwnut about 6 years
    How does going over the affected multiple times recovers data? By chance?
  • Jamie Hanrahan
    Jamie Hanrahan about 6 years
    Yes, pretty much by chance. It isn't effective very often. btw, what happened to my previous comment here? The one user1997744 is replying to?
  • Jörg W Mittag
    Jörg W Mittag about 6 years
    @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.
  • Attie
    Attie about 6 years
    I think the question is about reading an audio CD, and encoding to MP3, not reading a data CD that has an MP3 on it.
  • emk2203
    emk2203 about 6 years
    @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.
  • sam
    sam about 6 years
    @Attie correct i will update the original question to clarify
  • sam
    sam about 6 years
    @ypnos do you know which ripper library itunes uses ?
  • Andrew
    Andrew about 6 years
    Seems simple enough.
  • dandc87
    dandc87 about 6 years
    @sam Sorry, I don't but I expect it to be in-house. It is generally claimed to be less accurate than cdparanoia.
  • rackandboneman
    rackandboneman about 6 years
    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.
  • Display Name
    Display Name about 6 years
    @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.
  • Hagen von Eitzen
    Hagen von Eitzen about 6 years
    @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