PDA

View Full Version : How Replay Gain Works



pippin
2015-08-11, 14:31
It is a fact that almost all DAC's do not sound good with clipped signals. And this is what happens when recordings are mastered way to loud.

No, however often you repeat it, it is wrong.
If your mastering is mastered so loud that it clips no volume, gain or whatever change can get the signal back, it broken, you've got just noise, if you play it less loud it will still be noise.



Using replay gain you turn Down the heavy mastered recordings, and NO clipping comes to your DAC..... And it just sounds better....

If this works it means your DAC is fundamentally broken because it doesn't even meet one of it's minimum design specification which is to be able to handle maximum volume samples. These samples will be there all the time, even without dynamics compression and your DAC will then clip, too.
Life is too short to listen to a broken DAC, get a different one, every 2$-DAC has to be able to do this.

Actually constant high-volume signals are not even very complex. A permanent maximum-volume-signal is the most boring and most easy to handle signal ever, high dynamic range is more complex for the DAC.

This is not analog signal processing where people were mastering music all the time to go _beyond_ the specification which meant you could get clipping when playing that at high volume or even within your processing change. You can't master _beyond_ maximum in digital signal processing (or you get something permanently broken) and each DAc has to be able to cope with the maximum signal.

So if your clipping indicator goes up at full volume and does not when you apply replay gain, get a different DAC, it's broken. It's as simple as that. Most DACs even have plenty of range they can handle above the maximum values because that way you can avoid nonlinearities at the end of the range, clipping must not happen in a DAC.

Mnyb
2015-08-11, 21:20
I think it's when you have several consecutive samples of 0dB IE like say 10 full 16bit word lined up together . One 0dB peak is not a problem .

Yes some CD are deliberately digitally clipped too on top of the loudness war compression .

There are some treads on hydrogen audio about this and some old research white paper I can't seem to find where this is shown to happen in some consumer CD players .

Mnyb
2015-08-11, 21:29
Sorry my Google fu is bad but we had this discussion before on this forums to and there is a decades worth of discussion on hydrogen audio . The gist is that a full scale signal is ok for a DAC chip but may not be for an interpolation process like how they may be done in oversamplers or filters .
Similar to how I assume some lossy adio codecs apply some clever gain scheme to to clip the output .

Mnyb
2015-08-11, 21:31
Found my own post with some links.

http://forums.slimdevices.com/showthread.php?102378-More-victims-in-the-loudness-war

Julf
2015-08-11, 22:00
I think it's when you have several consecutive samples of 0dB IE like say 10 full 16bit word lined up together . One 0dB peak is not a problem

Yes, that's what I alluded to in one of my first answers to callesoroe's misconceptions. Badly designed DACs might not be able to handle the over-0-db peaks that result from interpolation (not related to compression or "loudness wars"), but the fix is simple - just turn down the volume a bit.


Yes some CD are deliberately digitally clipped too on top of the loudness war compression.

Yes, but that can not be magically undone with replay gain (or any other gain adjustment).

Julf
2015-08-11, 22:14
It is a fact that almost all DAC's do not sound good with clipped signals.

It is my experience that anything that starts with "it is a fact that" usually isn't.


Using replay gain you turn Down the heavy mastered recordings, and NO clipping comes to your DAC..... And it just sounds better....

Let me repeat - if the signal is already clipped, replay gain won't magically undo the clipping. All replay gain does is adjust the gain. If your DAC clips with a signal that is too loud, it is badly designed, but the situation can be easily fixed by turning the gain/volume down by a little - that is all replay gain does, too.


It is very visable on my system. When playing a loudness recording the VU meters on the Transporter bangs to the buttom, and The clipping indicator on my Tact
lights up all the time.......
Turning on replay gain VU meters are max at 0 db and mostly wide under. And the clipping indicator never lights up.
I rest my case....... I can see and hear what happens.....

No, you can see and hear what you *think* happens. What happens when you use replay gain is that the gain is reduced a bit - that is what you see on the VU meters, but you could have done the same by turning down the volume a little. The clipping indicator just detects "full scale" samples - so if you (or replay gain) reduce the volume, the clipping peaks are at a slightly lower level, and not detected by the Tact clipping indicator - but you haven't removed any of the clipping, just turned down the volume.

Clipping can be an issue with replay gain - because replay gain can *cause* clipping as a result of the gain adjustment done by replay gain. So replay gain can never remove clipping that is already in the signal, but it can cause additional clipping.

Mnyb
2015-08-11, 22:16
Yes, that's what I alluded to in one of my first answers to callesoroe's misconceptions. Badly designed DACs might not be able to handle the over-0-db peaks that result from interpolation (not related to compression or "loudness wars"), but the fix is simple - just turn down the volume a bit.



Yes, but that can not be magically undone with replay gain (or any other gain adjustment).

My references in my old tread is old , but when company's like benchmark did not fix this until 2013 what gives for other brands .

Misconception . I don't think you can say that all DAC's have this problem but an unknown ratio of them do have this problem but are they really badly designed ? In retrospect they are bad designs , but the signals presented by today's music is not " meant to be" if you ask some old school audio engineer ? What gives ?

1. Turn down the volume anyway you want replaying is one way it gives typically -10dB or use the volume control .

2. I would love to see test similar to those done in TC aes papers done to more recent DAC or some of the squeezebox models .

3. You can use an unfiltered nos DAC sans interpolation filters :P but give many any "bad" DAC instead and I happily employ -6dB digitally .

Mnyb
2015-08-11, 22:23
RG clipping by the rare album that actually gives positive gain ? Is that not fixed in LMS there was a bug report about that ?

Yes a constant volume adjustment might be more predicable . And we a have a fixed volume plugin somewhere if it's updated ?

Julf
2015-08-11, 22:46
Misconception . I don't think you can say that all DAC's have this problem but an unknown ratio of them do have this problem but are they really badly designed ? In retrospect they are bad designs , but the signals presented by today's music is not " meant to be" if you ask some old school audio engineer ? What gives ?

If you ask a really old school audio engineer, he (invariably a he) would have said that Jimi Hendrix' music was not "meant to be" - all that horrible distortion! :)

Intersample interpolation is not caused by overly compressing the signal - but simply by exceeding the maximum signal amplitude limit. You could cause it by a single, uncompressed sine tone that has too much amplitude for your digital channel. That is why Philips actually specified a lower-than-full-signal limit for the original CD specification, but very quickly gave up on trying to enforce it.


But let's be clear - we all (well, except for callesoroe) agree that the simple solution is to turn down the valume/gain a little bit, and that is all that replay gain does.


3. You can use an unfiltered nos DAC sans interpolation filters :P but give many any "bad" DAC instead and I happily employ -6dB digitally .

There are no totally unfiltered NOS DACs - the filtering just happens somewhere further down the chain, and if the components down he chain can't handle the signal amplitude, you still get clipping.

Mnyb
2015-08-11, 23:19
There are no totally unfiltered NOS DACs - the filtering just happens somewhere further down the chain, and if the components down he chain can't handle the signal amplitude, you still get clipping.

yes but that be "good" clipping from tubes or somesuch :))

yes i do understand that it is about the level .

But a way to actually get a bunch of 0dB samples together is the way we master these days almost everything is very close to max . it's not like in old recording thats it's once every 2 minutes or less when the drummer hit's a snare unusually hard (for example ) but rather all the time .
So when the producer maxes the volume suddenly it's more or less constant clipping .

yes phillips was rigth spare a couple of dB when producing CD's :)

Julf
2015-08-12, 00:14
yes but that be "good" clipping from tubes or somesuch :))

Of course! :)


yes i do understand that it is about the level.

Only reason I keep going on about it is that it seems callesoroe still doesn't understand that part.


But a way to actually get a bunch of 0dB samples together is the way we master these days almost everything is very close to max . it's not like in old recording thats it's once every 2 minutes or less when the drummer hit's a snare unusually hard (for example ) but rather all the time .
So when the producer maxes the volume suddenly it's more or less constant clipping .

Absolutely - all I was pointing out that it is a result of pure incompetence. It is really simple to get lots of 0dB samples together - just record a 1 kHz sine wave at +20 dB - but it is equally easy to avoid, by always leaving 6 dB or so of headroom...


yes phillips was rigth spare a couple of dB when producing CD's :)

They actually started out with that as a hard requirement - if you violated it, you couldn't use the "compact disc" logo. Too bad they rescinded that almost immediately :(

cliveb
2015-08-12, 00:43
RG clipping by the rare album that actually gives positive gain ? Is that not fixed in LMS there was a bug report about that ?
I was the person who reported that bug, and it was fixed years ago in SqueezeCentre (or possibly SlimServer), long before it was renamed LMS.

(Briefly: ReplayGain tags include a PEAK value that the playback software should take into account when processing positive GAIN tags, such that the gain is backed off if it would introduce clipping. SlimServer was failing to take this into account).

d6jg
2015-08-12, 01:15
I was the person who reported that bug, and it was fixed years ago in SqueezeCentre (or possibly SlimServer), long before it was renamed LMS.

(Briefly: ReplayGain tags include a PEAK value that the playback software should take into account when processing positive GAIN tags, such that the gain is backed off if it would introduce clipping. SlimServer was failing to take this into account).

Why is it called "Replay Gain" anyway when invariably its a negative. It should be Replay Loss :)

Sensibly LMS and other control apps translate the tag to "Volume Adjustment"

pippin
2015-08-12, 01:46
I think it's when you have several consecutive samples of 0dB IE like say 10 full 16bit word lined up together . One 0dB peak is not a problem .


Sorry, I still don't buy that. Even _if_ there were some DACs which had such a crappy design that their own interpolation filter created values that they would then clip, dynamics compression would actually make things better, not worse!
What's the worst case for your interpolation filter? It's not _several_ FFFF-samples, it's probably zeroes followed by a single FFFF-value or maybe two, followed by more zeroes. Get a digital spectrum analyzer and check it.
Lots of FFFF samples are a very simple and boring case and will always interpolate to more FFFF values with no clipping.

DACs are signal processing devices not speakers with mechanical parts and inertial. All you are discussing here makes a lot of sense for a speaker and at high volume a speaker might have more problems with compressed dynamics ranges, at least if it's got a badly designed filter (and you can never have perfect analog filters).
But people applying analogies from mechanical issues to electronic signal processing is a very common misconception in audiophile circles, just ignore the nonsense. It's the same thing as assuming vibrations from your speakers or whatever would have any impact on your signal processing just because they do for a vinyl record player because that one has a mechanical reading arm. But they don't, unless you shake your device to pieces or vibrations are so hard that they change the properties of open inductors they will not and if the latter happens it's - again - just a crap design and will be much more affected by temperature changes or humidity than vibrations.

You know: you read so much nonsense on this internet these days....



Yes some CD are deliberately digitally clipped too on top of the loudness war compression .

There are some treads on hydrogen audio about this and some old research white paper I can't seem to find where this is shown to happen in some consumer CD players .
OK, we had that, but Why would they do that and how? You mean they would drop the top bit or something? Or do you say that _cheap_ devices are adding complicated digital signal processing just to add even more dynamics compression?

In any case, as said before: if they did anything like that your recording is destroyed, get a better rip.

callesoroe
2015-08-12, 07:58
Sorry, I still don't buy that. Even _if_ there were some DACs which had such a crappy design that their own interpolation filter created values that they would then clip, dynamics compression would actually make things better, not worse!
What's the worst case for your interpolation filter? It's not _several_ FFFF-samples, it's probably zeroes followed by a single FFFF-value or maybe two, followed by more zeroes. Get a digital spectrum analyzer and check it.
Lots of FFFF samples are a very simple and boring case and will always interpolate to more FFFF values with no clipping.

DACs are signal processing devices not speakers with mechanical parts and inertial. All you are discussing here makes a lot of sense for a speaker and at high volume a speaker might have more problems with compressed dynamics ranges, at least if it's got a badly designed filter (and you can never have perfect analog filters).
But people applying analogies from mechanical issues to electronic signal processing is a very common misconception in audiophile circles, just ignore the nonsense. It's the same thing as assuming vibrations from your speakers or whatever would have any impact on your signal processing just because they do for a vinyl record player because that one has a mechanical reading arm. But they don't, unless you shake your device to pieces or vibrations are so hard that they change the properties of open inductors they will not and if the latter happens it's - again - just a crap design and will be much more affected by temperature changes or humidity than vibrations.

You know: you read so much nonsense on this internet these days....


OK, we had that, but Why would they do that and how? You mean they would drop the top bit or something? Or do you say that _cheap_ devices are adding complicated digital signal processing just to add even more dynamics compression?

In any case, as said before: if they did anything like that your recording is destroyed, get a better rip.

One of the leading Engeneers in Digital Audio(Peter Lyngdorf, Founder og Lyngdorf Audio and Tact) says something else about DAC's and clipping.
There is a video on youtube where loudness war is discussed(with Mark Knopfler). I must say I agree more with him....
Unforunally it is in Danish so I don't think you will understand it, so no reason for link to the video.
But what you call crappy desing is the real World handling crappy input.

Julf
2015-08-12, 12:51
One of the leading Engeneers in Digital Audio(Peter Lyngdorf, Founder og Lyngdorf Audio and Tact) says something else about DAC's and clipping.
There is a video on youtube where loudness war is discussed(with Mark Knopfler). I must say I agree more with him....
Unforunally it is in Danish so I don't think you will understand it, so no reason for link to the video.
But what you call crappy desing is the real World handling crappy input.

Too bad you didn't post a link - I can probably understand enough Danish. So, instead, how about you, in your own words, explaining what part of what we have been saying you don't agree with, and why?

And do you agree with the statement that all replay gain does is adjust the gain of the track - just like turning down (or, very rarely, up) the volume control?

Julf
2015-08-12, 13:20
One of the leading Engeneers in Digital Audio(Peter Lyngdorf, Founder og Lyngdorf Audio and Tact) says something else about DAC's and clipping.
There is a video on youtube where loudness war is discussed(with Mark Knopfler). I must say I agree more with him....
Unforunally it is in Danish so I don't think you will understand it, so no reason for link to the video.


This one (https://www.youtube.com/watch?v=Of2JvNXHXOI)? It is 34 minutes long, and seems to be a general rant against loudness wars. Can you explain how it is relevant to replay gain?

The only way replay gain is relevant to the loudness wars is that as the broadcast and streaming companies, and companies like apple, are starting to apply the ITU gain adjustment standards, the incentive to overly compress music material to make it carry over a broadcast goes away - but unfortunately producers will still want the music to "sound like on the radio".

callesoroe
2015-08-12, 15:08
This one (https://www.youtube.com/watch?v=Of2JvNXHXOI)? It is 34 minutes long, and seems to be a general rant against loudness wars. Can you explain how it is relevant to replay gain?

The only way replay gain is relevant to the loudness wars is that as the broadcast and streaming companies, and companies like apple, are starting to apply the ITU gain adjustment standards, the incentive to overly compress music material to make it carry over a broadcast goes away - but unfortunately producers will still want the music to "sound like on the radio".


Yes it is that video. And he also says that almost all DAC's don't like clipped signals. He also plays an example on the computer.....

pippin
2015-08-12, 17:39
Umm... wait, but that would be something else. Of course a DAC doesn't like clipped signals because the result will be nothing that makes sense so all of it's filters might make garbage of the remaining signals, too (not just the clipped frequencies).
But again.... if your digital signal is clipped you can not "unclip" it.... Not with replay gain, not with anything else.

Mnyb
2015-08-12, 20:23
Umm... wait, but that would be something else. Of course a DAC doesn't like clipped signals because the result will be nothing that makes sense so all of it's filters might make garbage of the remaining signals, too (not just the clipped frequencies).
But again.... if your digital signal is clipped you can not "unclip" it.... Not with replay gain, not with anything else.

No you cant unclip anything , but the point is that some digital filters and oversamplers makes things worse if the clipping is representerade as consequtive 0dB samples "intersample overs" they internally try to calculate levers above 0dB and some react badly and produces even more distorsion . This effect is real as these kind of signal is out of spec and many DAC and filter chip designers did not consider them to ever be present on a CD . Of course you can have blocks of clipped signal by good old fashioned distortion in the music , but to some filters this is not the same as also "clip" the digital medium by trying to exceed the 16 or 24 bit you have to represent the signal .

But as said just lover the volume -3 to -6 dB.

But as Julf said you can get this phenomen by to much level by any signal not just loudness war music . But it is also vey common practice to do that on such music .

But I would like to see this measured in present day products , but it is telling that benchmark did not consider this until recently ? And they are considered one of the best DAC designers that just not buy a set chips and slap together a nice looking products like most hig end brands .

Julf
2015-08-12, 22:36
Yes it is that video. And he also says that almost all DAC's don't like clipped signals. He also plays an example on the computer.....

And how is that relevant to replay gain?

If your original music is clipped (by the producer/recording engineer), there is no way to "unclip" it. It will stay clipped, even if you allow replay gain to change the volume.

Let me repeat: The only way replay gain is relevant to the loudness wars is that as the broadcast and streaming companies, and companies like apple, are starting to apply the ITU gain adjustment standards, the incentive to overly compress music material to make it carry over a broadcast goes away - but unfortunately producers will still want the music to "sound like on the radio".

So, again, do you agree with the statement that all replay gain does is adjust the gain of the track - just like turning down (or, very rarely, up) the volume control? If not, why not?

Mnyb
2015-08-12, 23:48
Are we 3 talking past each other ?

*The recorded clipping as present in the original signal does not go away with replay gain I don't think anyone believes that ?

*Aditional problems by intersample overs and overloading the digital signal chain downstream

*How squeezebox volume works

*How replaygian works , by adjusting the same volume by values specified in the tags . Usually down by circa 10dB in some rarecases up due to the "target volume"

Mnyb
2015-08-12, 23:58
Sorry 4 of us .

two kinds of clipping .

*Inherent in the signal . it's there forever .

*to high input to something digital or analog does not matter (for example callersroe's TacT or my meridian processor )

Julf
2015-08-13, 00:24
Are we 3 talking past each other?

To some degree, yes.


*The recorded clipping as present in the original signal does not go away with replay gain I don't think anyone believes that?

I think *almost* all of us agree. Not sure about callesoroe.


*Aditional problems by intersample overs and overloading the digital signal chain downstream

Right. A well-known issue (there was a good paper on it at AES109 in 2000, 15 years ago), but some DACs still don't deal with it very well. We all also agree that if you turn the volume down by 3-6 dB (or let replaygain do it for you), it becomes a non-issue.


*How squeezebox volume works

*How replaygian works , by adjusting the same volume by values specified in the tags . Usually down by circa 10dB in some rarecases up due to the "target volume"

Right. All replaygain does is turn the volume control up or down, just as if we would be doing it manually. This, I think, is the essential misunderstanding by callesoroe.

Julf
2015-08-13, 00:32
Heh. As a result of this discussion, I revisited some of the classic AES papers. One, from 1999, states "Clearly, to obtain the goal of music conservation, new standards are needed.
One way to go would be to establish a set of gentleman processing rules that need to be followed in order for the CD to get a DRA stamp, a Dynamic Range Approval."

The more things change...

utgg
2015-08-13, 01:28
*How squeezebox volume works


There seems to be an assumption from Julf that all squeezebox volume (including replay gain) works by digital scaling of the digital input samples prior to input the DAC - and with a decent 24-bit DAC that is a fine thing to do. But is this true for all squeezebox and 3rd party hardware players? There is certainly the option to apply the volume to digital attenuators after the DAC instead, and the last version of squeezelite from Triode gives the option to do it this way, via ALSA mixer settings, (assuming the hardware has digital attenuators and the ALSA mixer system uses them).

Mnyb
2015-08-13, 01:51
There seems to be an assumption from Julf that all squeezebox volume (including replay gain) works by digital scaling of the digital input samples prior to input the DAC - and with a decent 24-bit DAC that is a fine thing to do. But is this true for all squeezebox and 3rd party hardware players? There is certainly the option to apply the volume to digital attenuators after the DAC instead, and the last version of squeezelite from Triode gives the option to do it this way, via ALSA mixer settings, (assuming the hardware has digital attenuators and the ALSA mixer system uses them).

With hardware squeezeboxes this is the case as it is the same volume and signal that eventually becommes the spdiff output , so it's a 24bit scaled signal all hardware squeezeboxes are 24bit all the time with the 8 lower bit's padded to 16 bit sources .
Then it can scale with the volume .

Software players who knows ? they *should* emulate this . someone knowing the code has to answer this .

Julf
2015-08-13, 02:49
There seems to be an assumption from Julf that all squeezebox volume (including replay gain) works by digital scaling of the digital input samples prior to input the DAC

No, not assuming that at all, as it really doesn't matter (for the purpose of this discussion) where the volume correction happens - it is still exactly the same correction no matter what causes it - replaygain or a manual volume control change.

Yes, the digital volume control vs. UDB-controlled volume attenuation after the DAC has implications for the intersample interpolation issue, but doesn't affect the topic of this thread - "How replay gain Works". Replay gain is simply a track-per-track instruction to adjust the volume, it doesn't do anything magic beyond that (unless we are talking about a replay gain implementation that actually implements it's own digital gain control separately from the normal playback process).

pippin
2015-08-13, 05:24
There seems to be an assumption from Julf that all squeezebox volume (including replay gain) works by digital scaling of the digital input samples prior to input the DAC - and with a decent 24-bit DAC that is a fine thing to do. But is this true for all squeezebox and 3rd party hardware players?

Hardware players: yes (not sure about Transporter and Slimp3 but about SB3/Boom/Radio/Receiver/Touch).

Software: depends. As I wrote before: in iPeng it depends on the downstream hardware, software-side BOTH the volume and replay gain control are separate, I could imagine it's similar on Android devices; you mention SqueezeLite.

BUT (a huge "but"): if it's separate, then replay gain will very, very likely be separate, too, and just be factored into the volume level because you exactly do not want to change the bitstream if you don't have to.
There should never be any difference between how replay gain is being handled to how volume gain is being handled.

So either not playing at 100% volume already fixes your clipping issues or both do not.

Fahzz
2015-11-26, 10:26
Where/when in the does the replay gain processing take place? Does the signal have to pass through the SB3 DAC for the replay gain to be applied?

I recently switched from analog outs to coax into my receiver which has its own DAC. Sometimes a track seems louder or softer than the others. Have I bypassed the SB#replay gain processor?

Thanks. Happy Thanksgiving if applicable.

Mnyb
2015-11-26, 21:53
Where/when in the does the replay gain processing take place? Does the signal have to pass through the SB3 DAC for the replay gain to be applied?

I recently switched from analog outs to coax into my receiver which has its own DAC. Sometimes a track seems louder or softer than the others. Have I bypassed the SB#replay gain processor?

Thanks. Happy Thanksgiving if applicable.

No replay gain works equally on both digital and analog out .

What I don't clearly remember is how it's coexist with the fixed volume at 100% setting .

it could be the clipping protection kicking in .
This is not that exact , the subjective experience of music you know .
Are the replay gain tags made with the same tool at the same time ? Things like the target volume have changed I think ? Or at least there is now a standard .

pippin
2015-11-27, 02:07
For SB3 that's probably a question someone from Logitech has to answer since nobody else has seen the firmware.

I'd assume it's the same from the behavior of Touch and Radio (where it is) and from the fact that all volume handling happens in the digital domain (except for Boom, IIRC) but it's hard to definitely know without looking at the firmware.

Fahzz
2015-11-28, 14:38
What I don't clearly remember is how it's coexist with the fixed volume at 100% setting

This seems to be the issue. I did change that option when I went to a smart remote setup with an SB3. Now I disabled it, and I think the problem is solved.

Fahzz
2015-12-05, 11:17
So... Smart Gain not working. I'm wondering if the SB3 has Smart Gain capability, since it's not mentioned in the manual, but crossfade is. I'd be glad to hear from anybody who knows.

atrocity
2015-12-05, 12:09
So... Smart Gain not working. I'm wondering if the SB3 has Smart Gain capability

I always used SmartGain when my players were SB3s...