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: Difference between Replaygain and Foobar implementation? (Read 3445 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Difference between Replaygain and Foobar implementation?

Hi all. I love Foobar and have just begun tagging my catalog with replaygain info but I have noticed some anomalies between applications to do so.

Can someone point me please to any information regarding the changed implementation of Replaygain as of Foobar 2000 1.1.7?
I have searched and found general discussions of the RG standard vs. the newer RG128 which appears to be the difference but nothing specific to the Foobar usage of either.

I have noticed that in certain cases FLAC files encoded with replaygain info via METAFLAC or a Fb2k version pre-1.1.7 and the same file scanned and encoded with Fb2k v 1.1.7 (and possibly higher) can produce extreme differences in gain calculations.

It isn't in all files and a small survey of 4 tracks scanned in 3 different ways indicates that there appears to be no correlation between proximity to a calculated gain of 1.0 and the variance in applied gain in each method.

By using MP3Tag to view the RG tag info, it is clear that some tracks are different by a tiny factor (generally .25 dB which I doubt I can hear after years of playing drums).  Some others however are extreme as I illustrate below.
I have not looked further into any major subjective difference in sound quality between these closely related tracks.

To confirm that notable differences in the "...GAIN" tags were audible, I copied a single FLAC file and scanned and tagged using different programs, each track as a single album.
In this case, "Willow Weep for Me" from The Complete Capitol Recordings by Art Tatum which is a painfully quiet and noisy pressing.

The peak calculations are the same minus some rounding...

Fb2k 1.1.1 - Album & Track Peaks - 0.871796
Fb2k 1.1.7 - Album & Track Peaks - 0.871796
MetaFLAC - Album & Track Peaks  - 0.87179565

It's the gains that are different.

Fb2k 1.1.1 - Both Gains = +0.18 dB
Fb2k 1.1.7 - Both Gains = +2.36 dB
MetaFLAC -  Both Gains = +0.19 dB

To see if there was any audible difference, I used the ABX comparator add on. After enabling the replaygain setting I began my trials.
10/10 was enough for me to be certain that I could hear the difference in applications of the replaygain.

Ignoring for the moment any preference (i.e. one sounds better than the other) I have a couple of questions.

I know it sounds different partly because one version in this case seemed to sound louder than the other but is it doing the same thing?
Obviously based on some of what I have read there are significant technical differences so let's keep it general for the moment.

If the newer version is perceptively louder, doesn't that make the old and new versions incompatible, essentially where any old files will be subjectively quieter than the new ones?

Am I misunderstanding the application of the info? For example, is the gain as listed in the tag, less important than the peak info?

Considering the fact that the info for playback is embedded in the tag, wouldn't a player other than foobar respond to this newer implementation differently?

Thanks for any help any one can offer. I hope I landed this post in the right place.
-joose

Difference between Replaygain and Foobar implementation?

Reply #1
I hope I landed this post in the right place.
Not really. Support is for reports of (potential) problems, not for questions. Its rules make that quite clear. And this does not seem to be a problem.

From the changelog:
Quote
1.1.6
[…]
ReplayGain scanner now uses libebur128 for improved accuracy.
Users with the relevant technical knowledge can expand (or you can read one of the topics about EBU R128 in the non-foobar2000 subfora of Hydrogenaudio), but this basically means that differences in calculations are to be expected. libebur128 estimates perceived loudness using a different algorithm, and therefore it is perfectly possible that its calculated target volume might differ from that of the original ReplayGain algorithm.

Quote
If the newer version is perceptively louder, doesn't that make the old and new versions incompatible, essentially where any old files will be subjectively quieter than the new ones?
Of course it’s possible (but not inevitable) that differences (but not necessarily uniform ones such as a constantly higher volume) might emerge if you use a library some of whose files are ReplayGained by different algorithms. I suppose you’re meant to re-scan if you’re worried about the possibility. It would be a good idea anyway.

Quote
Considering the fact that the info for playback is embedded in the tag, wouldn't a player other than foobar respond to this newer implementation differently?
What do you mean? Few players support RG information as written by foobar2000 anyway, but those that do will apply it in exactly the same way, so the final perceived loudness amongst tracks will be the same (i.e. possibly including discrepancies introduced by differing algorithms) regardless of whether you play from one or the other.

Again, those with proper knowledge of RG could provide more information (or correct me if I’ve got something wrong), but that’s the summary as I understand it.

Difference between Replaygain and Foobar implementation?

Reply #2
Sorry about the categorization error.  I overestimated the technicality of my concerns with the variations in gain.
Based on your response it seems that what I have encountered is, or at least can be, an (occasionally) expected outcome.

I appreciate your response to my questions.

I had seen the change you indicate from the log which in part prompted my inquiry. Thanks for expanding on that. I had that something was amiss though I'll admit I'm still befuddled by the peak values matching but the gains being different.

All things being equal (though I suspect they're not) bummer about having to rescan everything that's already done. Oh well.

My concern regarding two different code implementations being "read" differently by other players or perhaps older versions of Foobar is likely unfounded. It's based on the same befuddlement I mention above.

Off to do more reading to try to hunt down the specifics.
Thanks for pointing me in the right direction.

-joose

Difference between Replaygain and Foobar implementation?

Reply #3
I’m glad it helped!

I'm still befuddled by the peak values matching but the gains being different.

The peak value of a given track is always going to be the same. That track always has its highest sample at that level, and it can’t be altered by some algorithm that is run on it after-the-fact.

The gain, on the other hand, is specific to the psychoacoustic algorithm being used, and therefore it can change accordingly between versions.

Quote
All things being equal (though I suspect they're not) bummer about having to rescan everything that's already done. Oh well.

What do you mean? What other concerns do you have/suspect?

Quote
My concern regarding two different code implementations being "read" differently by other players or perhaps older versions of Foobar is likely unfounded. It's based on the same befuddlement I mention above.

The only thing that will be read in any case is the gain value. Different algorithms will write different values, but all programs will read the same value for any given track.

Quote
Off to do more reading to try to hunt down the specifics.
Thanks for pointing me in the right direction.

As I said, I’m glad to help (in whatever limited way I can). Perhaps someone else with more knowledge can offer some more input here, too.

Difference between Replaygain and Foobar implementation?

Reply #4
The reason I say that I suspect things aren't equal is based on the accuracy comment in the changelog.
If the newer version is more accurate then my sense is there is may be a difference in the sound of the application.
Obviously, that's up to me to determine and decide if re-scanning is the route that I want to take.

In terms of my befuddlement, part of your response lead me to believe that something basic in my understanding of ReplayGain implementation (regardless of the writing algorithm) is completely skewed.

In your last post you explained to me that,
Quote
The peak value of a given track is always going to be the same.


I get this and it makes perfect sense to me. A peak measurement of Sample X will always be the same.

Quote
The gain, on the other hand, is specific to the psychoacoustic algorithm being used, and therefore it can change accordingly between versions.


This also makes sense to me since the loudness is not measured by the exact same set of parameters and standards.

Quote
The only thing that will be read in any case is the gain value. Different algorithms will write different values, but all programs will read the same value for any given track.


Underline added by me to indicate the point that I am still trying to wrap my head around.
It still just seems completely counter-intuitive to me that the different written gains are (in a manner of speaking) the same when considering loudness.

But, I think that I am hung up on the idea that the gain reduction from the measured peak should be an absolute number (XdB down from peak regardless of content.)

I haven't been thinking of it as a "loudness" adjustment but rather an absolute volume adjustment which is why I suspect I'm having confusion.

I'm working my way through some of the more technical discussions of ReplayGain here in the forums in an effort to get it.

I just wanted to chime back in and say thanks again for taking the time to help.
-joose

Difference between Replaygain and Foobar implementation?

Reply #5
What I mean is that the different implementations of RG might write different gain values to your files, but whichever value is written will be interpreted and applied in the same way by any player.

That was in response to this:
Considering the fact that the info for playback is embedded in the tag, wouldn't a player other than foobar respond to this newer implementation differently?


The difference in the algorithms is simply that the newer one is thought to more accurately estimate and thereby enable compensation for perceived loudness. The algorithm has changed, but the method of storing its result has not. Thus, other players would apply whatever gain result is written in the same way as foobar2000 would.

And yes, perceived loudness is evaluated in a way much more complex than simply finding the peak and applying gain from there. Hopefully your reading will help this to make sense!

 

Difference between Replaygain and Foobar implementation?

Reply #6
Quote
The only thing that will be read in any case is the gain value. Different algorithms will write different values, but all programs will read the same value for any given track.

It still just seems completely counter-intuitive to me that the different written gains are (in a manner of speaking) the same when considering loudness.

Think of it like this:

We have a music file called X.
We create a copy of X and call it Y.
Program A uses an algorithm to write an RG value of +3 to file X.
Program B uses another algorithm to write a different RG value of +5 to the copied file Y.
Program C plays back both files X and Y, and uses the +3 to adjust X and the +5 to adjust Y. It doesn't know anything about how A and B arrived at their respective values, so C can only treat both files the same way, depending only on how C itself interprets the gain values.

In the end A and B wrote different values for the same audio data, but C treated both files the same way, it just read the gain value and applied that.

(At least that's what I think db1989 was trying to say)
It's only audiophile if it's inconvenient.