Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: CD rip to flac results in clipped flac (Read 11295 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

CD rip to flac results in clipped flac

I'm sure this topic has come up before, so if someone has a link to threads that explain how to deal with it, I'd appreciate just that as well.

Here's the problem: I got some CDs (I can upload a sample slice of the flac file output if required to see the problem if needed, but it should be obvious), Om, Variations on a Theme, Holy Mountain Records.

The system is Debian Linux, Lenny, though I can also check it in Sid if there's been an update in the tools. The ripping tool I use is abcde, a command line perl script that basically just rips using flac tools and then tags it from cddb, and creates nice output files.

So I don't think the ripping app abcde is the problem, since it just calls the native flac codecs.

As I've done hundreds of times before, I run abcde, it dutifully rips the CD to flac, no errors. The CD plays perfect in a CD player, and also in the computer's CD player.

The flac files, however, are totally clipped. Not just slightly. When I view the playback visualization from the CD playback, I can see the peaks maxing out. When I open the flacs in Audacity, I can easily see and hear the clipping.

So the question is, what is causing this, and how do I create a flac rip that is not clipped?

Again, I've ripped my entire music collection and I've never had this issue, but the CDs I just got from Holy Mountain show this extreme level thing, which someone I talked to said is a known issue with some CDs.

Since I don't really play CDs anymore, just flacs, I need to know how to fix this issue. Any help or technical explanations are appreciated, and sorry if this has been asked before, I couldn't find it in my forum searches, though I did find threads that references the issue slightly.

CD rip to flac results in clipped flac

Reply #1
Quote
I just got from Holy Mountain show this extreme level thing, which someone I talked to said is a known issue with some CDs.
  That would be The Loudness War[/u].  (The clipping is on the CD.)

It's very, very, very unlikely the clipping is being introduced during ripping or FLAC encoding...  If you do get ripping errors that's not the kind of error you get.    I suspect if FLAC were somehow failing and distorting the waveform, clipping wouldn't be the result either  (You'd probably get an unplayable file).

Of course, the shape & height of the unclipped waveform can never be known, but there are a few tools that attempt to repair clipping.  Audacity has an "effect" called "Clip Fix".  I've experimented with Clip Fix a little, but I didn't do a very thorough evaluation.  It did make the waveform look a lot better, but it still didn't sound that good.  I think it made some  improvement.

And usually when a CD is clipped, it's also hyper-compressed (dynamic-compression, not file-compression), so clipping is only one factor in the lousy sound.

CD rip to flac results in clipped flac

Reply #2
Thanks, this is aggravating, since I bought these specifically to rip them to flac.

Sounds correct, I noticed that the standard visualization graph of the frequencies was maxing out too on cd playback on the computer.

What's annoying is that there is no clipping on playback, only when this data is introduced to the flac codec for processing, which leads me to believe there must be some way to handle the problem.

The CD sounds really good when played, definitely no clipping that I can hear, either via a good onkyo cd player or via the computer cd rom.

But thanks for pointing me in the right direction so I at least  know what's going on.

CD rip to flac results in clipped flac

Reply #3
What's annoying is that there is no clipping on playback, only when this data is introduced to the flac codec for processing, which leads me to believe there must be some way to handle the problem.


If the levels aren't identical between them, then you've done something wrong.  Either whatever software encoded the flacs is introducing some effect, or your flac player is.

CD rip to flac results in clipped flac

Reply #4
What I'm doing is exactly the same as I've always done, so the only difference is in these cds, apparently the 'loudness' issue.

What I'm guessing is this: the playback software in the cd player and in the computer doesn't really care about maximum levels of input from the cd, but the encoding software expects the music to be under the standard level, aka, 100%. Anything over this theoretical 100% is then fully clipped off. It appears to me that the playback software does not have this idea in it, it just seems to play the louder levels and is fine with it.

I'm going to test this on some newer flac encode in Debian to make sure this isn't an issue that has already been taken care of, but at least now I sort of know what to call it, how to identify the behavior.

In other words, I believe the levels are identical, in fact, I can roughly see this when using a visualization type frequency level meter, but I believe, judging from what my ears tell me, which is quite non subtle, that whereas flac encoder is treating this 100% level as a top max, after which it is visibly and audibly clipped, the cd player and playback software simply accepts it and lets it be above 100%. There's definitely no clipping of the type that happens on flac encoding however, there couldn't be, or the people couldn't sell the disks. It does strike me as a clever way to exploit a weakness in flac encoders however, if that were the goal it's certainly succeeding in stymieing  my ripping efforts so far, but there is a solution out there somewhere, I know it. Too many smart music loving eyes on the problem, plus I know you can get torrents of this same exact music that doesn't clip, so there is some way around it.

CD rip to flac results in clipped flac

Reply #5
I would even bet money on that the "clipping" is also there when you play the CD.

Take whatever 80's CD, pop it in your player and listen... You need to turn the volume up, right? That's because almost all modern CD's are mastered maximizing (compressing and limiting) the volume as much as possible. Also it's not really clipped - digital audio per se, cannot really be clipped, as peaks will always be within the digital range. These CD's are limited by the roof, so that's (unfortunately) how they are supposed to sound. Although, clipping could occur in the decoding stage if your soundcard is not able to handle peaks well. Try using digital out. you may also be biased, believing your hear clipping only when played from PC, since you believe the peaks are only there.
Can't wait for a HD-AAC encoder :P

CD rip to flac results in clipped flac

Reply #6
I'm talking about HUGELY audible, to the degree that the flacs are unplayable, clipping. I mean, clipping as in technical clipping the sine wave is sliced and the speakers crackle as if they are blown. That's with the flac playback. This is not present in the cd playback.

Whatever is going on here is somewhat interesting, but the flac is literally unplayable, unless of course I want to blow out my speakers from the radical clipping, which I don't personally want to do. The CD directly is completely playable and sounds great, and has zero such audible clipping. Keep in mind that clipping is a technical term that means the sine wave is actually cut, with an abrupt adjustment to the 100% level, instant, which is what kills the speakers and what creates the audible static.

There is a solution to this, as I noted, since I have heard torrented versions of these that did not clip like this, and I am virtually certain that whatever the people used to rip those did not create this issue, or handled it somehow. It's certainly a problem, and this is literally the first time I've heard it, but it figures, these are all heavy records, so I guess the mastering guys thought they'd make a stupid heavy mastering job. That's what the volume knob is for guys, please....

To repeat, I am not talking about some subtle thing here, I'm talking about clearly visible clipping when viewing in Audacity, the flac file, and I'm talking about speaker breaking clipping on playback. I think you're thinking of something else here, though I appreciate the input, we're not talking subjective or subtle here, we're talking unplayable audio, with heavy digital noise and damage, when in flac.

But I'll try these on a newer version of the flac encoder codecs and see if those solve it.

Just for the record, I've worked as an audio engineer, briefly, and have studied audio in the past, so although I'm not up on the newer problems, like this, I am familiar with the core concepts, which don't really change. And a clipped sine wave is one such core concept. Sadly, a digitally clipped wave sounds even worse than an analog clipped one, something I've discussed with a friend whose spent a decent amount of time recording in studios. So forget about the 'it's in my head' approach, this is a major failure, not something that I have to strain to hear.

CD rip to flac results in clipped flac

Reply #7
Something is wrong in your setup. Ripping correctly will create an identical copy of the CD (assuming no gross scratches, etc) in wav files. Encoding to FLAC is completely lossless. Regardless of whether or not you're sure the setup is the same as last time you (successfully) ripped CDs you need to double-check some things as this shouldn't ever happen.

Are you verifying your rips with AccurateRip?

CD rip to flac results in clipped flac

Reply #8
@teetering:  Can you rip to WAV (or even just raw PCM) with the same setup, just as a "sanity check" to see if it still occurs then?  I have zero experience with ripping on Linux, so I don't know if that's even an option with your setup, but it would at least help to trace down where the increase in level is happening.

The reference FLAC encoder doesn't have any way to alter the level of the incoming PCM samples (as opposed to something like LAME with its "--scale" command), so unless there's additional processing code incorporated into the "flac tools" you're referring to (sox?), the FLAC encoder can't be the source of the clipping.
"Not sure what the question is, but the answer is probably no."

CD rip to flac results in clipped flac

Reply #9
mixminus1, I'll try a few things, rip to wav, rip using freshest versions of flac encoding stuff. I don't however think there's an increase level perse happening, I think what's happening is that the players, whether the embedded cd player, or the software driven pc ones, simply handle the extra boost on top differently, some looseness in the algorithm would be my guess that is not present in the flac encoder.

Maybe I'll slice out a sample of flac, and of wav, and post a link here, again, I have never seen this issue before, but this is a small independent label and the music is ultra heavy, so I can easily see the mastering guy having done something so extreme that it triggered a failure event. Even some of my heaviest on-u dub reggae cds don't do this, and they push the mastering to the max point, but they I guess don't go past it. The Cds in question are on Holy Mountain records, Om and Mammatus.

CD rip to flac results in clipped flac

Reply #10
I'm talking about HUGELY audible, to the degree that the flacs are unplayable, clipping. I mean, clipping as in technical clipping the sine wave is sliced and the speakers crackle as if they are blown. That's with the flac playback. This is not present in the cd playback.


If the FLAC isn't identical, you've done something wrong and need to trouble shoot it.

CD rip to flac results in clipped flac

Reply #11
saratoga, the purpose of my posting here is to troubleshoot this issue, so your comment unfortunately is not helpful. My goal posting here is to find solutions, I suggest posters who have nothing concrete to add to this thread resist the urge to post, since others will use this thread hopefully to solve the problem, so make an effort to keep the signal to noise ratio to a reasonable level. For example, the first person to respond showed the actual cause. So that was a good useful response. And mixminus1's suggestion is likewise a useful idea, that might reveal further information about the issue.

I'll run some tests and see what I can come up with, but avoid the 'you've done something wrong' type answer, it's not helpful at all, also avoid the 'you're imagining hearing that your speakers are going to blow out' type responses, and I think we'll be able to solve this issue both for me and for others referencing this thread.

CD rip to flac results in clipped flac

Reply #12
try ripping it a different computer, go to a friends house and rip it in itunes using alac if you don't have access to any other computers.

CD rip to flac results in clipped flac

Reply #13
I wonder if the clipping is taking place with in your playback software.  I remember something similar back in the days of Winamp 2.xx where a different eq was used for mp3 vs cd playback and this could lead to issues.  Also perhaps you've added replaygain info to the flacs and the player has the replaygain preamp set too high?
"You can fight without ever winning, but never win without a fight."  Neil Peart  'Resist'

CD rip to flac results in clipped flac

Reply #14
Excellent suggestions, I'll check into that. The replay gain / playback is definitely worth checking into, I'll check the defaults. Ripping on another machine is also a good suggestion, I tried that yesterday in fact.

I'll get back here with the results once I I look into what the files actually contain a bit more closely.

 

CD rip to flac results in clipped flac

Reply #15
dreamliner, you and dvddoug are close in your analysis.

It appears to be a combination of things, which accounts for how hard it is to figure out.

Your notion that the playback software could be relevant is correct, although I suspect it's actually the playback software's audio backend that is the culprit, since I was able to duplicate the crackling on another audio playback app. The two apps in question here are aqualung and Quod Libet. A third app, which oddly enough usually doesn't play clearly, Amarok, does not crackle on playback. The issue is only on these three cds however, although I now realize I have heard such crackling artifacts from some flac tracks I did not create. I'd never really given it much thought, but now that I have more data on the question I see it's probably related as well.

My goal here is to actually fix Aqualung via sending them a bug report, or the audio backend, so to do that I'll need to collect the real debugging information that the software authors need to fix the issue.

I looked in my ripping app and it has a lot of settings for replay-gain, can someone here suggest the raw settings I should send the flac encoder? Is there any downside to removing replay-gain? This is all new to me, so I'm not clear on the various outcomes, the defaults have always worked exactly as intended for me.