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: Misunderstanding regarding ReplayGain in foobar2000 (Read 7111 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Misunderstanding regarding ReplayGain in foobar2000

Since I have created Anthology and Best Of folders of a couple of my favorite bands, I want to be able to listen to the whole playlist without having to change the volume while still obtaining the dynamic differences between songs from the same source / album.
Therefore I selected the respective files and went for "scan selection as albums (by tags)" [all files are correctly tagged]. Now it seems to shift the volume of all files to a common level, but unfortunately it even lowers the volume of my already comparably quiet vinyl rips.

As you can see it would apply -3.43 dB (with the album peak being 0.963...) and -4.92 (-"- 0.979) to the two vinyl rips. Shouldn't that be +3.7 and +2.1 respectively (1 - Album peak)? Or rather 0.89 - Album peak or 0.89 + preamp - Album peak.

I would basically like for the song with the highest peak in each album to be as loud as possible and for the other songs' volumes to be corrected respectively.

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #1
Replaygain is not a peak normalizer, files with higher peaks not necessarily have higher reduction level. Try the attached files, they have same peaks but different RG results.

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #2
ok, but does foobar always choose the loudest possible (without introducing clipping to any song) baselevel (here ~0.93)? If not, how do I make it do so?

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #3
ok, but does foobar always choose the loudest possible (without introducing clipping to any song) baselevel (here ~0.93)? If not, how do I make it do so?

It doesn't use the peak value at all.  Instead all tracks are adjusted to a reference volume.  The peak value is only stored in case you want to prevent clipping latter.  See:

https://en.wikipedia.org/wiki/ReplayGain#Target_loudness

Edit:  if you just want to peak normalize tracks rather than make them the same volume, use peak normalization.  If you want equal loudness, but want tracks to be louder, increase the volume when you play them back.

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #4
Quote
As you can see it would apply -3.43 dB (with the album peak being 0.963...) and -4.92
Here's what you can do -

After applying ReplayGain, find the peaks of all the files in your album/playlist.  The highest peak tells you how much headroom you have. 

For example, if the highest peak on all of your files is -1dB, you can increase all of your files by +1dB.

Quote
Now it seems to shift the volume of all files to a common level, but unfortunately it even lowers the volume of my already comparably quiet vinyl rips.
Yes, that's normal.  In order for ReplayGain (or other volume matching) to work you have to allow-for quiet-sounding songs with 0dB (or near 0dB) peaks.  Since you can't boost those quiet songs (without clipping) you have to reduce the louder (and maybe even your average-volume) songs to match the quiet ones.    Even with the default ReplayGain settings, some quiet songs can't be boosted enough to match the others, so it's a compromise.


P.S.
The vinyl recording/playback process introduces phase-shifts that make some peaks higher and some peaks lower without affecting the dynamics of the sound.    The resulting higher peaks mean that a normalized vinyl rip will be quieter (it will have a lower average or RMS level) than the same normalized digital recording.

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #5
ok, thank you all! I think I understood now.

So what I wanna opt for is basically "scan selection as albums (by tags)" unless there are no reasonable album tags (e.g. tracks with no album entry in tags are considered as being part of the same album) available. In that case I want to go for "scan per-file track gain". Any way to do that?

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #6
ok, thank you all! I think I understood now.

So what I wanna opt for is basically "scan selection as albums (by tags)" unless there are no reasonable album tags (e.g. tracks with no album entry in tags are considered as being part of the same album) available. In that case I want to go for "scan per-file track gain". Any way to do that?

This is what the "Scan selection by album (using tags)" option does.  Track gain for everything, Album gain as well if there are tags.

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #7
Yeah, but can I in any way make it "understand", that songs with an empty album tag are not part of the same album and dynamic differences between those songs should not be kept. Instead they could be treated as individual tracks.
I am now manually doing this, but it takes some effort.

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #8
Maybe a better way to ask the question:
Can I change ReplayGain's target value from 89dB to another?
Suppose I perform a track analysis of all my music files, that determines that the loudest target level, at which no new clipping is introduced, is 91.5. Can make ReplayGain target that level for all tracks / albums?

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #9
The analysis replaygain target should be kept constant because the expectation is to have a common loudness.

What you want to do is to change the playback replaygain target. You can do so from fooobar2000, go to Preferences, playback and increase the slider that it says "Preamp , with RG info"

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #10
Yeah, but can I in any way make it "understand", that songs with an empty album tag are not part of the same album and dynamic differences between those songs should not be kept. Instead they could be treated as individual tracks.

Yes, this is what that setting does.

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #11
The analysis replaygain target should be kept constant because the expectation is to have a common loudness.

Suppose the analysis returned 91.5dB as the point at which some files start to clip, that would be my global ReplayGain target.

What you want to do is to change the playback replaygain target

That would only help me, when I'm playing the music files in foobar though, right? I have tried setting different values with different avoid clipping and such options and the relative change to the files' loudness is always the same, if I analyse them via foobar ReplayGain.

The actual reason why I am so careful to make my files any quieter than they need to for a common level, is that I'm not sure my android VLC has a preamp or I can increase the volume sufficiently for my in-ear-headphones. Plus it's nice to have the music be played louder through the speakers.

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #12
I'm pretty sure vlc has a preamp, although I'm not 100% sure if it supports replaygain on Android. Have you tried googling it?

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #13
Yeah, but can I in any way make it "understand", that songs with an empty album tag are not part of the same album and dynamic differences between those songs should not be kept. Instead they could be treated as individual tracks.

Yes, this is what that setting does.

Well my foobar2000 1.3.12 applies the same album gain to all files with no album tag, when scanning the selection as albums (by tags).

I'm pretty sure vlc has a preamp, although I'm not 100% sure if it supports replaygain on Android. Have you tried googling it?

According to what I read, it does. I've posted in a VLC forum regarding the preamp on Android, but I doubt it. I think it's possible to make android play music beyond 100%, but pretty sure you need root access for that.

Generally wouldn't it be a cool feature for foobar / ReplayGain to always go for the highest target feasible for all files globally.

It's not complicated to determine, when files start clipping, right?

I understand, it gets problematic once you add new files to your music collection that happen to clip at the lowest threshold of all files. But even in that case, it would be easy to just subtract the difference between former lowest clipping point vs. lowest clipping point of the new files from each files RG tag.

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #14
Well my foobar2000 1.3.12 applies the same album gain to all files with no album tag, when scanning the selection as albums (by tags).
At least you can select all files without album tag, and remove album peak/track info from them.

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #15
Generally wouldn't it be a cool feature for foobar / ReplayGain to always go for the highest target feasible for all files globally.

It's not complicated to determine, when files start clipping, right?
If you mean amplitude (as in prevent clipping):
1) Replaygain does not pretend to be "amplitude normalization to 100%" (or to any other target)
2) Normalization has been proven to be inadequate in terms of getting a common loudness.
3) Album gain goes for the average gain for the whole album. That's the best way to maintain a common loudness even when each individual file would need a different gain.
4) To detect the peak amplitude of a file is easy. But to get something meaningful out of it is another subject altogether.
A lossless file with integer bit depth would never go above 1.0 (full scale). That same file converted to MP3 could perfectly have a peak amplitude of 1.3 (above full scale). The Replaygain value should be almost the same (it could have some cents of difference).
If clipping value is to be respected, some players with replaygain offer the option "clipping prevention". (in foobar2000, it is in the dropdown list that selects between album or track gain)

I understand, it gets problematic once you add new files to your music collection that happen to clip at the lowest threshold of all files. But even in that case, it would be easy to just subtract the difference between former lowest clipping point vs. lowest clipping point of the new files from each files RG tag.
Do you mean that you want replaygain to decide which target it has to use based on all your previous replaygain scans, and apply the gain that ensure that no file clips? If any, something like that could help you determine a good target playback gain, but in practice, that means potentially modifying your whole library when doing a single file scan. (And any file you get from someone else that has replaygain would need to be rescanned for your library, so in some sense, your files would not be compliant)

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #16
[all files are correctly tagged].
foobar2000 1.3.12 applies the same album gain to all files with no album tag
If your files are missing album tags, i wouldn't qualify them as correctly tagged.
But anyway, i've run into this situation before. I had a various artists album where none of the tracks had been level matched.
I use MP3tag for tagging, and you can use it to quickly take all the values from the %REPLAYGAIN_TRACK_GAIN% tag and save them to %REPLAYGAIN_ALBUM_GAIN%, giving the result you're looking for.
This may be possible with other software or even foobar, i don't know.

As for the main topic: I feel like maybe you're overcomplicating things unnecessarily.
Are you actually having any trouble with volume or distortion? I've personally never had any trouble with just using plain old 89db replaygain without checking for clipping.

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #17
Maybe I'm missing something, but why is writing the track gain to the album tag a problem? Isn't that what you want?

Anyway, I'm looking at the vlc app and there is a gain slider on the eq screen, although it's not labeled in db which makes it hard to use.

Re: Misunderstanding regarding ReplayGain in foobar2000

Reply #18
Clipping is an overly-demonized boogieman. I've long been under the impression that those who complain the loudest understand its affect on audibility the least. Even worse when it comes to clipping caused by decoding lossy to integer.

As with everything, hearing differences requires properly controlled testing, not listening while looking at numbers or waveforms.