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: ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain... (Read 3899 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain...

Hi all

I've been reading about this topic to try and get my head around it, so I have fragments of info but am having trouble tying it all together and wondered if any people here might be able to help?! 

I've been slowly ripping through my CD collection using dBpoweramp; ripping to FLAC and Mp3 at the same time.  I use a ReplayGain DSP in the programme to write Track and Album RG (EBU R128 -18 LUFS).  Track and Album peaks reach a maximum of  1.000000; never above.  I have learnt that in DBPA the RG is calculated on the source material, and the results are therefore always the same for FLAC and Mp3.  If done AFTER the encoding, there would be slight differences. 

Aside from my CDs, I have a bunch of random Mp3s and FLACs that people have given me, I've downloaded, etc.  I've been sorting them out, tagging them, and so on, and have now come to add RG tags.  I ran a small selection of them through the RG codec in DBPA (mostly Mp3s) and noticed immediately that a lot of the Track and Album peaks were higher than 1.000000.  Some were a lot higher. 

From what little I can get my head around, I think this is something to do with the fact they are Mp3s.  And this would make sense in the light of the CD ripping I've done seeing as the RG is calculated on source (CD).  I'm guessing now that if I re-did the RG on some of those ripped Mp3s properly, I'd start to see some +1 peak values that weren't there before.  That is a guess though, so maybe I should try it out to find out for sure....

Anyhow, I wondered first and foremost whether these +1 peak values are to be expected  when adding RG tags directly to Mp3s?  Are they a problem at all and if so how might problems might be caused.  I also like to get my head around these kinds of things as much as possible, so any explanation would be much appreciated too.

Cheers

Max




Re: ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain...

Reply #1
Anyhow, I wondered first and foremost whether these +1 peak values are to be expected  when adding RG tags directly to Mp3s?

Yes absolutely.  MP3 is a lossy audio format.  If you put in files with a peak of 1.0, then they will come out almost certainly with a higher peak (unless the mp3 software decreases the gain).  If you want files to not change, you need lossless, which of course saves the original file exactly as is.

  Are they a problem at all and if so how might problems might be caused.

They will be clipped back to 1.0 most likely, which in theory isn't ideal.  In practice I don't know that it makes any audible difference. 

Re: ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain...

Reply #2
As far as I know, a compliant MP3 decoder should be able to handle peaks over 1.0 with no issues and no clipping. Certainly if you use replaygain, the peaks will be brought down far enough that clipping definitely won't happen.

I've had some MP3s with calculated peaks as high as 10.0, which I assume occurs due to encoding errors or some other data corruption. In all of these cases, I've re-ripped and re-encoded the files and ended up with much more realistic peak values.

Re: ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain...

Reply #3
Many thanks for the helpful replies.  Since posting, I also found this thread which I thought was pretty helpful on the topic:

https://hydrogenaud.io/index.php/topic,65076.0.html

I think everything is more or less clear now.  The only thing I'm not certain about is what the "Disable Clip-Prevention" tick box on the ReplayGain Codec in dBpoweramp does.  I have asked on that forum.  But in the meantime, if anyone here at HA knows (who doesn't use the DBPA forum) it would be great to hear from you.

Cheers

Re: ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain...

Reply #4
Since both, the replaygain value, and the peak amplitude is saved in the file, there are two ways of applying the replaygain value

First one is just apply replaygain.
Second one is apply replaygain, but only as much as you could without making the peak go higher than 1.

Generally, the peak should still be below 1.0 after applying the replaygain, but depending on the additional amplification, or the type of content (let's say, just some talking), it could pass that value.
Using "disable clip-prevention" would allow this second case to clip. Else, it would get amplified less than its replaygain value says.

Re: ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain...

Reply #5
Thanks for taking the time to explain that [JAZ].  Still a bit unclear on it though I'm afraid.  If I read your response with playback of the Mp3s in mind, then it makes sense to me, but not if I read it with the actual process of calculating and adding the RG  in mind.  You say "applying the replaygain value" which makes me think you might have been have been talking about playback...  But it is all a bit murky so I could have completely got that wrong.  Perhaps you can clarify?  

Many thanks

 

Re: ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain...

Reply #6
Yes.. replaygain is always about playback (mp3gain/aacgain can affect the file itself, but we're not talking about those here).

So it goes like this:

File A  -> Replaygain Scan -> Peak and replaygain values stored as metadata.
File is played -> Player changes the gain of the audio according to the replaygain value and other replaygain settings -> audio comes out from the speakers.

So what I said applies on that second to last step.

Re: ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain...

Reply #7
Yes.. replaygain is always about playback

Sorry, I wasn't very clear.  What I meant was playback as opposed to the calculation of the gain/peak values and the writing of the tags.  The "processing" of the RG, so to speak. 

So it goes like this:

File A  -> Replaygain Scan -> Peak and replaygain values stored as metadata.
File is played -> Player changes the gain of the audio according to the replaygain value and other replaygain settings -> audio comes out from the speakers.

I had a bit of a eureka earlier when a light came on and everything fell into place, thanks to you guys here and some others who have been helping me on another forum.  So yes, that all makes sense now and I'm most pleased to finally have my head wrapped around it.   Here's how I explained my understanding on the other forum (with specific regard to the RG codec in DBPA):

A) In v3/R3 of ReplayGain [an older version; we're on v5/R5 now], there was no "Disable Clip-Prevention" box. It acted as though it was UNTICKED, and therefore any tracks that needed clip prevention were automatically given it by default.

B) This is why you sometimes got a "Warning: Normalisation gain would have resulted in clipping, gain has been reduced to prevent this....." in the log. So the warning told you that Clip_Prevention had been used, as well as giving you the figures.

Foobar has the option in preferences > playback > processing to choose between "apply gain" and "apply gain and prevent clipping according to peak". This goes hand in hand with the "Disable Clip-Prevention" option in DBPA. So:

- If "Disable Clip-Prevention" is unticked, DBPA does the necessary reductions to prevent clipping and so in foobar I would select "apply gain"

- If "Disable Clip-Prevention" is ticked, DBPA does not do any reductions, and so in foobar I would select "apply gain and prevent clipping according to peak"


Please correct me if I'm wrong in any of the above.  I might cry, but it''s best I know now rather than later :) 

Thanks again

Re: ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain...

Reply #8
I think they swapped the definition

Disable unticked -> "apply gain and prevent clipping"
Disable ticked -> "just apply gain"

Re: ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain...

Reply #9
I think they swapped the definition

Disable unticked -> "apply gain and prevent clipping"
Disable ticked -> "just apply gain"

That's what I meant :)  It was late!

Re: ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain...

Reply #10
Thanks for all of the really helpful replies in this thread. I've managed to get my head around most of it now and am clearer on what I want to do.

There is one remaining point I would like some clarification on though...

I understand now that the reason why mp3s/lossy (and not FLACs/lossless) have peak values above +1.00000 is because of the way they are processed for encoding and decoding, the fact that they floating point, and technical things like that!  So I'm happy with the fact that where I have had the RG calculated directly on the mp3 and not the lossless source, I am seeing high (over +1) peaks. My question is: what relationship or relevance does this have to the peaks that are dealt with by using clip prevention (either during processing or playback)? Are they two completely separate things and if not how does one have a bearing on the other?

I hope that makes sense!!! I'm happy to try and clarify if not, with the emphasis on try!  :)

Many thanks

Re: ReplayGain - Track and Album peaks above 1.000000 on Mp3s. Please explain...

Reply #11
Prevent clipping just means that the volume is reduced by a tiny fraction such that all peaks are no more than 1.0.