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: Question on Replaygain (Read 5784 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Question on Replaygain

Scenario: I apply replaygain --auto, separately, to a folder contanining a whole album encoded with mpc.

Subsequently, I encode a second album and apply replaygain --auto to the folder containing the encoded mpc's.

Finally, I decide to prepare a collection cd, and decode - say - three mpc's (two from one album, and one from the second), using option --gain 2 --prev in the front end.

This should "replaygain" the three mpc's, bringing their loundness (on the final cd-r) within a reasonable range from each other.

Now, the questions are:

1) How can replaygain do this, given the "--auto" command was applied to each folder separately, without allowing the software to calculate relative loudness of all the folders (from where I subsequently choose the mpc's for my collection)? Shouldn't it be a *relative* value?

2) Since the beginning of my using EAC, I always followed the principle that you *should create a cd which is as close as possible to the original*. I understand that replaygain is - like modern restauration of paintings - always reversible. However, if I apply replaygain when *decoding* mpcs (and subsequently burning them on cd-r), am I not altering the final outcome, making it different from the original? Albeit this would be higly recommended on collection cd's (subject to my question under 1), I do not want it at all - for example - on live recordings...

3) I have encoded thousands of mp3 using Dibrom setting "extreme" without even being aware of the issue of clipping. Now I understand that I should be using "--xlevel" and "replaygain" each time I encode/decode mpcs, in order to avoid clipping.  Honestly, I have been listening my collction of mp3s on a high end system, without noticing any clip/artifact.  Is this something related to mpc encoding only? And doesn't it change the encoded mpc from the original, as stressed under 2?

Thanks for your attention!

Jeova69


'I've never met anyone who tried a joint but
didn't inhale.'
Jeova69

I've never met anyone who tried a joint but
didn't inhale.
(H. Marks)

Question on Replaygain

Reply #1
Quote
1) How can replaygain do this

"replaygain --auto" calculates and stores within every mpc file the four numbers: title peak, album peak, title gain, album gain.

The decoder switch "--gain 2 --prev" ignores the album peak and album gain,  and applies the title gain. So all mpc files play about the same loudness although they are from different albums.
Clipping prevention "--prev" is activated if "title peak+applied title gain" value is outside of 16bit range.

Quote
However, if I apply replaygain when *decoding* mpcs (and subsequently burning them on cd-r), am I not altering the final outcome, making it different from the original? Albeit this would be higly recommended on collection cd's (subject to my question under 1), I do not want it at all - for example - on live recordings...

Yes, if you want to burm mpc to cd-audio and get exactly the same loudenss levels as original cd, then just decode without any switches (without --prev, wothout --gain). Sometimes (not very often), the decoded mpc will clip too much creating an audible distortion, then you should use album based clipping prevention "--prev gain 1".

(For live recordings there is the album gain "--prev --gain 3" switch)

Quote
3) I have encoded thousands of mp3 using Dibrom setting "extreme" without even being aware of the issue of clipping. Now I understand that I should be using "--xlevel" and "replaygain" each time I encode/decode mpcs, in order to avoid clipping. Honestly, I have been listening my collction of mp3s on a high end system, without noticing any clip/artifact. Is this something related to mpc encoding only? And doesn't it change the encoded mpc from the original, as stressed under 2?


mppenc "--xlevel" switch fixes the rare "internal clipping" problem. It has nothing to do with "clipping" in usual sense or with replaygain.

Clipping of decoded mp3 or mpc is not always so bad. If there are only a few clipped samples then it would not be audible.
Digital clipping - how much is too much?

Question on Replaygain

Reply #2
Quote
"replaygain --auto" calculates and stores within every mpc file the four numbers: title peak, album peak, title gain, album gain.
value is outside of 16bit range.


Yes, but which is the relative value that it takes into consideration when it calculates title peak and title gain? Is it standard for every file?

J
Jeova69

I've never met anyone who tried a joint but
didn't inhale.
(H. Marks)

Question on Replaygain

Reply #3
Quote
using option --gain 2 --prev in the front end.

1) How can replaygain do this, given the "--auto" command was applied to each folder separately
"mppdec --gain 2 --prev" means "Track gain", attenuated if necessary to avoid clipping at peaks.  This would work even when you replaygained each track separately.
Also the "Album gain" is only to keep the relative volume between the tracks of one album the same. All tracks of one album will be gained (+ or - ) the same amount.  Tracks from a louder album should have a different gain than those from a quieter one.
Quote
2) ... EAC, I always followed the principle that you *should create a cd which is as close as possible to the original*.

Yeah, but if you do lossy compression in between it's not original anymore, it just sounds like the original
Quote
3) I have encoded thousands of mp3 using Dibrom setting "extreme" without even being aware of the issue of clipping.

Maybe you can read up on that subject (using the search function on this forum)? It is not MPC specific but happens on decoding of most lossy codec’s. For mp3 you could use mp3gain to level the loudness differences between tracks or albums and also avoid clipping.
If your thousands of mp3's didn't have loud peaks, you would not have clipping in the first place.
--
Ge Someone
In theory, there is no difference between theory and practice. In practice there is.

Question on Replaygain

Reply #4
Quote
Yes, but which is the relative value that it takes into consideration when it calculates title peak and title gain? Is it standard for every file?

Ah, so that's what you're asking
Read Replay Gain Calculation
--
Ge Someone
In theory, there is no difference between theory and practice. In practice there is.

Question on Replaygain

Reply #5
Quote
Yes, but which is the relative value that it takes into consideration when it calculates title peak and title gain? Is it standard for every file?

Ah, yeah.  The replaygain calculation link above is a must to read.

Just note that all up-to-date replaygain tools (mpc replaygain, mp3gain, vorbisgain) have adopted a different reference value for the target loudness: 89 dB.

83dB has more headroom for very loud sounds but it is generally too quiet when played back on cd-players etc.
My personal observation is that most classical discs, and well-produced jazz and rock discs have the loudness of about 86-91 dB (rough guesstimate).

Question on Replaygain

Reply #6
Thanks.... BUT

You say that clipping is related to any and every encoding codec, such as mp3 or mpc. However, if I simply play through winamp an encoed mp3 it does not produce particular clips (or at I least I do not perceive them). What does winamp do with mp3? Does it automatically apply some sort of k- setting in order to avoid clipping?

Or am I right in assuming that clipping is more directly and immediately related to mpc's?

g
Jeova69

I've never met anyone who tried a joint but
didn't inhale.
(H. Marks)

Question on Replaygain

Reply #7
Quote
...Edit: deleted this big quote...

Quote
You say that clipping is related to any and every encoding codec, such as mp3 or mpc.

Yes.
Quote
Or am I right in assuming that clipping is more directly and immediately related to mpc's?

No.

[span style='font-size:8pt;line-height:100%'](My observation is that if there is some clipping, the amount of clipping is roughly the same both with mp3 and mpc.)[/span]

Try to experiment yourself a little. Take a few very loud tracks from your cds and encode them to mp3 and mpc. Run through mp3gain and replaygain and compare the peak values.

Quote
However, if I simply play through winamp an encoed mp3 it does not produce particular clips (or at I least I do not perceive them).

If you encode the same material to mpc and play it in winamp with replaygain and clipping prevention deactivated and K = -14, do you perceive any clipping?

Quote
What does winamp do with mp3? Does it automatically apply some sort of k- setting in order to avoid clipping?

No, if you disable all equalizers and dsp in winamp then mp3 are played 'as is'.

(if mp3s have been mp3gain'ed, then winamp will play them mp3gain'ed, because winamp cannot know if mp3gain was applied or not)

Question on Replaygain

Reply #8
Quote
What does winamp do with mp3? Does it automatically apply some sort of k- setting in order to avoid clipping?

No, not that I know of.  Only the MAD (MP3 decoder) plug-in has that built-in.
Quote
Or am I right in assuming that clipping is more directly and immediately related to mpc's?

Again, no. You could try it, you might not notice with mpc either . And if you set your Headroom setting low enough (-20 maybe) there would be no clipping at all. Only the mpc would play back not as loud as the mp3's

You could check some of your mp3's with mp3gain (just analyse) to see if they are actually clipping or not. After all clipping happens  a lot more with compressed, loud (after todays standards) CD's.
--
Ge Someone
In theory, there is no difference between theory and practice. In practice there is.

Question on Replaygain

Reply #9
On the basis of this pictures, wouldn'it be useful, for the benefit of all posters, to provide a clear and definitive definition of the k- values and settings (as well as of the dynamic range) in the winamp plugin?



It seems that, by altering the k-value, we are lowering or raising the amount of *headroom* (i.e. the red portion of the image). But doesn'it it necessarily entail a corrspondent reduction or increase of the yellow and green portions?
Jeova69

I've never met anyone who tried a joint but
didn't inhale.
(H. Marks)

Question on Replaygain

Reply #10
Quote
On the basis of this pictures, wouldn'it be useful, for the benefit of all posters, to provide a clear and definitive definition of the k- values and settings (as well as of the dynamic range) in the winamp plugin?

It seems that, by altering the k-value, we are lowering or raising the amount of *headroom* (i.e. the red portion of the image). But doesn'it it necessarily entail a corrspondent reduction or increase of the yellow and green portions?

yeah... it sort of reminds me of this wonderful discussion
As you see, it's almost a year a go, and nothing has changed in the plugin settings terminology... I guess it is too low priority for Klemm or anybody else to bother...

To be honest, I didn't care to really get into these dB/K/whatever scales.
If I understand correctly, the headroom scale in the mpc plugin has rather vague relation to the K-systems.
Perhaps, it really should be called 'pre-amp' or maybe just 'headroom'.

How it actually works for the current plugin.
First the output replaygained according to title or album gain, and then additional gain is applied according to the chosen "headroom".
"K-14" means 0 additional gain.
"K-20" means negative additional gain (i.e. attenuation --> more headroom for the peaks).
"K-12" means positive additional gain (i.e. pre-amp --> less headroom for peaks)

...Now I'm scratching my head: when does the clipping prevention kick in???
I think it should be the very last step, after additional gain. Otherwise it will not work.
This I have to check...

Edit: yes, I just verified this: the clipping prevention works fine! so it must be the last step.

Edit2: In fact, it is probable that the "additional" gain is applied first, and then the replay gain. Someone need to look in the source code.
But it doesn't matter, as the two gains just sum up.

Question on Replaygain

Reply #11
Thanks..

By the way,  I has already come across that thread  before posting my questions on replay gain... However, the thread did not seem to have come to a definitive conclusion on these (interesting yet complicated) issues...

You are helping me a lot with your comments, although some final - authoritative - word on this would be mostly welcomed - I think - by most posters...

g

p.s. Just to continue with experimentations, I ripped Concert No 5 by Beethoven (live version with Michelangeli as pianist) and attained a dodgy result: album gain on each track is approx +3, whereas title gain on track 2 is +11! (on tracks 1 and 3 it is +3).

I encoded the same wavs in mp3, applying mp3gain, and the result is not identic (albeit similar): +2, +2 +10 of title gain, +2, +2, +2 of alcum gain (using 89 db) as a target...
Jeova69

I've never met anyone who tried a joint but
didn't inhale.
(H. Marks)

Question on Replaygain

Reply #12
Sorry, I mean + 10db track gain in the second track...
Jeova69

I've never met anyone who tried a joint but
didn't inhale.
(H. Marks)

Question on Replaygain

Reply #13
Quote
...with Michelangeli as pianist...

Mmm!... delicious!..

Quote
album gain on each track is approx +3, whereas title gain on track 2 is +11! (on tracks 1 and 3 it is +3).

Looks ok. The second part is very quiet, so the title gain is high.

Quote
I encoded the same wavs in mp3, applying mp3gain, and the result is not identic (albeit similar): +2, +2 +10 of title gain, +2, +2, +2 of alcum gain (using 89 db) as a target...

mp3gain can only apply gain changes in steps of 1.5dB (the limitation of mp3 format).
So, what is it "+2" gain? Is it +2 dB?
It can be +2 in the sense "+ 2 steps" = +2*1.5dB = +3dB
But then what is +10 ????? I don't understand it. What does mp3gain says the peak value for that track ?

I have just made the same as you did, with a quiet piano track. The peak and gain values are about the same with mpc (+9.30dB) and mp3 (+9.28dB).

Edit: I got an idea: throw the original mp3s in foobar2000 and make it calculate the gains.
(I don't use foobar, so can't advise how to do it exactly.)

Question on Replaygain

Reply #14
Quote
p.s. Just to continue with experimentations, I ripped Concert No 5 by Beethoven (live version with Michelangeli as pianist) and attained a dodgy result: album gain on each track is approx +3, whereas title gain on track 2 is +11! (on tracks 1 and 3 it is +3).

I encoded the same wavs in mp3, applying mp3gain, and the result is not identic (albeit similar): +2, +2 +10 of title gain, +2, +2, +2 of alcum gain (using 89 db) as a target...

But that's not a dodgy result - track 2, i.e. the second movement - that's the quiet one, isn't it? I bet it even says so on the musical score. So, track gain, doing its job of trying to make all tracks the same loudness, says it should be adjusted more than the rest. That's not wrong. What's (subjectively) wrong would be using the track gain - do you really want the quiet movement of a Beethoven symphony to be adjusted so that it's just as loud as the loudest movement?

ReplayGain isn't perfect, otherwise (good) mp3 encoding wouldn't make a difference. But there ya go - the numbers aren't bad for an automatic system.


Re: The old thread (which I'm not going to drag back up again by replying to there)...

I'm sorry I didn't notice the thread first time around. My comments would have been short and sweet because I'd already had a similar conversation with Frank via email...

Background: When I wrote the ReplayGain website (which I have totally failed to update), the only ReplayGain calculation was on Matlab on my PC. Moving it to the fastest machine on campus, I could get 0.5x real time processing, and with this I calculated the values which I listed on the site. As soon as the site was up, I had a long email conversation with Bob Katz, starting the same evening, and continuing for three days. He made some excellent points, and corrected several things. He was correct on all accounts, and I changed everything that he suggested should be changed.

Apart from this, I was thinking in a vacuum. All the proposals for player support and file formats were just initial proposals. In retrospect, I think my ideas for player support were spot on, but my ideas for file formats were quite hopeless!

When I saw the mpc Winamp plug-in (before the slider was labeled with "K" numbers, though it was still "headroom" rather than "pre-amp"), I thought "This confuses me - and I invented the thing! What chance do normal people have?!". I emailed Frank, and asked why he hadn't just gone with a "pre-amp" slider - what was the point of using a "headroom" slider, which performed the same function, but operated in an inverse manner. I said "headroom" would be counter intuitive to most people, since a larger value makes the music quieter.

He replied that "pre-amp" didn't give any indication of what it was there for, or of what setting was appropriate. He added the K-values to the headrom slider, so that there is some notion of what would be a good setting for various types of music (or mastering styles!).


<begin defense of Frank's use of K-values>

This isn't (generally) a miss-use of the K-system - though I would bow to Bob Katz's better judgement if he said otherwise. It's not totally correct, but it's not wrong: what I mean is, if album-based replaygain worked perfectly and intelligently, it would correct for mastering and loudness differences between albums, while maintaining artistic differences between tracks (and albums!). This is impossible for an automatic tool to do, but it's a concept - if you follow that concept, then the K-numbers make sense...

If the track was mastered using K-20 (which means that the RMS sample value is nominally -20dB FS, i.e. 20dB below digital full scale, giving 20dB headroom above the average level), then the replay gain adjustment would be zero, and a sensible headroom setting would be K-20. If the track was mastered using K-14 (RMS nominally 14dB below digital full scale, leaving 14dB headroom between average and digital full scale), then the replay gain adjustment would be minus six. Applying replay gain without pre-amp or headroom or anything would just take the whole thing back down to the "average" level of a K-20 recording - which is fair enough if you have lots of K-20 recordings, and you want the K-14 recording to sound the same loudness. BUT if you don't have any K-20 recordings then you might as well leave the K-14 albums where they are (6dB higher then replay gain would put them) - using K-14 headroom will do this - it's just the same as +6dB on a pre-amp.

So, if you like, what replay gain is trying to do is to guess the K-values, and take them all back down to K-20. If you knew the K-value for a particular recording, but you had replay gain enabled, it would set it back to K-20. If you know that it won't clip at K-14, because it's a K-14 recording, then you can adjust the headroom slider to put it back to K-14. If you have a genuine K-20 recording, and put the headroom slider to K-14, it will clip, because the top 6dB of the range of the recording is now being pushed above digital full scale.

If you have a recording which isn't actually recorded and mastered using the K-system, it must still have a K-value. It might be something weird like K-13.7, but there is still a loudness of listening which makes the album the "right" loudness, and you can measure that loudness, and express it on the K-scale. If you like, ReplayGain tries to do this.

<end defence of Frank's use of K-values>


I don't think there should be headroom and K-values in the mpc plug-in. I think it should use something like the system I originally suggested for player support.

http://replaygain.hydrogenaudio.org/player.html

The above defense of the use of K-values isn't strictly accurate. For one thing, ReplayGain can't guess the K-values correctly (you need an experienced mastering engineer for that - and even then, it's a guess if he doesn't know!). For another, Frank was very keen to point out that ReplayGain was just an automatic volume equaliser, and that it didn't have anything to do with appropriate replay loudness. It can only do equal replay loudness. This is perfectly true - I wanted to leave space to store the "appropriate" or "real" or "human judged correct" loudness adjustment, which could be used if ever mastering engineers decided to include this information on CDs and DVDs. Frank thought this was a waste of space. I've only just realised the contradiction that he's using K-numbers as an indication of headroom alone, when really they're an indication of appropriate loudness; but he's put this indication of appropriate loudness at the heart of his user interface, while refusing to include space for it in mpc files.


So there you have it. Yes it is confusing. Yes it could be easier. But it's not necesarily incorrect, and Frank does understand the position. He probably doesn't accept that normal people really don't understand or care about this, and just want a player that works without them having to think too much!

Cheers,
David.
P.S. Most questions emailed to my first name at my last name dot org do get answered eventually.

Question on Replaygain

Reply #15
Quote
Edit: I got an idea: throw the original mp3s in foobar2000 and make it calculate the gains.
(I don't use foobar, so can't advise how to do it exactly.)

you can do it using the winamp replaygain plug-in too - just send all the files through using the dummy output plug-in, and look at the log file containing all the calculated replaygains. (Thanks to Snelg for this idea). Obviously you'll get different results if you do at after mp3gain-ing them!

Cheers,
David.

P.S.  kdo - I didn't see your post before I posted my previous post - If I had, I wouldn't have re-answered the queston about the Beethoven which you had already answered!

Question on Replaygain

Reply #16
Quote
But that's not a dodgy result - track 2, i.e. the second movement - that's the quiet one, isn't it? I bet it even says so on the musical score. So, track gain, doing its job of trying to make all tracks the same loudness, says it should be adjusted more than the rest


What I thought it was dodgy was a difference of more than 7db, although I completely understand your point (and agree with it).

Quote
p.s. Just to continue with experimentations, I ripped Concert No 5 by Beethoven (live version with Michelangeli as pianist) and attained a dodgy result: album gain on each track is approx +3, whereas title gain on track 2 is +11! (on tracks 1 and 3 it is +3).


Sorry if I quote myself... But I was wrong. Mp3gain applied to Concert No 5 gives +1,5db +10db +1,5db of trackgain, whereas replaygain gives +3db, +11, + 3db (of trackgain). Therefore the result is similar, albeit not entirely...
Jeova69

I've never met anyone who tried a joint but
didn't inhale.
(H. Marks)

Question on Replaygain

Reply #17
But see kdo's reply - mp3gain has to round to the nearest 1.5dB.

D.