ReplayGain in FLAC

I would like to know, how does ReplayGain works on FLAC file format?

I have been using MP3Gain for years now. With it I can pump up the volume in MP3 file and reverse that process without quality loss. But I use it for the opposite: if I have to edit and MP3 file, which happens to be pumped up [nd they almost always are], I can lower it down [before encoding it to WAV for those editing purposes]. In a matter of fact, I do this every time for new MP3 files [because I always do some editing on new files, so it’s more efficient for me to do unnecessary RG operation that to go back later on for those that do really need it

Unfortunately MP3Gain does not works with FLACs [or other files]. So I have three question:

1] Does ReplayGaining feature [function?] on FLACs works the same way? I mean: if a FLAC file is pumped up, do I have to [should to] lower it down before encoding to WAV [just like MP3]? Or maybe that r-gain info is somehow stored differently in them; and so audio in WAV won’t show up raised as it is in FLAC [from which that WAV was created]?

2] Does ReplayGaining on WavPacks works the same way? Do all files are treated the same way with this process?

3] What [preferably as simple as MP3Gin] software could I use to check / change replay gain on FLACs [and maybe some other files]? All I found was foobar2000, but it doesn’t seem to work neither for FLACs and MP3’s [“remove ReplayGain information from files” just do not affect my MP3, which I do can change with MP3Gain]

4] Why do all FLACs that I download from the Internet look like they have been put through the process of [aw ay too much] normalization? In the waveform they look like they should sound bad- but they don’t

See --add-replay-gain

The audio data in a FLAC file is not affected by ReplayGain. In Flac files, ReplayGain is implemented as metadata tags which tell the player how loudly to play the file.
Audacity does not support ReplayGain, so when you import a Flac file you get the actual audio data (the ReplayGain tags, if present, are ignored).

But that is by the choice of Audacity’s creators? That ignoring of ReplayGain value?

So I would have to ask the same question to the creators of audio file converters, that I’m currently using [4dots Free Audio Converter, Switch Sound File Converter Plus]? To know, if I have to remove that [hypothetical] gain information before I encode FLAC to for example WAV [for editing purposes to be done not in Audacity]

Or is somehow that ignoring some universal [mandatory] approach for all other FLAC capable editors?

ReplayGain is designed to help media players play back files at a similar volume level. I’ve never come across an audio editor that takes any notice of ReplayGain tags.
The situation is different when applying ReplayGain to WAV files, because in this case the actual audio data is changed (it is not a lossless process).

But to FLACs? Or are you talking overall?

I’m using old Sony Sound Forge 7.0 for editing. If the ReplayGain in MP3 file is not lowered [beyond the point of clipping] then after such pumped MP3 is loaded into Sound Forge, the audio is permanently destroyed. [And so, in short, that is why I take extra precautions and lower the volume via ReplayGain before editing any MP3]

And may concern is: if FLAC is pumped up, and I convert it to WAV, is then such a WAV also pumped [practically destroyed for ever] or not? Does this depend on the software that does the conversion or not, because FLAC files are treated by ReplayGain different than MP3?

What exactly do you mean by “pumped up”? ReplayGain tags should only tell the player how much gain to apply to the audio on playback, they should not change the audio in any way. You seem to be under the (false) impression that ReplayGain compresses the dynamics in some way. The only dynamic compression that “may” occur as a result of ReplayGain tags is that ReplayGain stores the peak amplitude of the track, and some players provide an option to “limit” the maximum peak level on playback so as to avoid clipping peaks. The idea of ReplayGain is that “quiet” tracks can be automatically played a little louder, and “loud” tracks can be automatically played quieter, so that you don’t need to be constantly adjusting the volume level of your player.

I don’t use Sound Forge, but if Sound Forge is damaging your files, then you could take that up with Sony. What Sound Forge does or doesn’t do has nothing to do with Audacity.

“ReplayGain” is an algorithm for measuring “loudness”.
“ReplayGain Tags” are metadata tags (similar to id3 tags) that store the results of the ReplayGain analysis.

In the case of MP3 files, depending on how ReplayGain is implemented by the ReplayGain scanner application, and/or what settings have been chosen, the playback level may either be written to metadata tags, or may be written as a “gain” parameter in the MP3 data. When metadata tags are used, the audio data is not changed at all, so players (or editors) that do not support ReplayGain Tags will play the track at the original level (ignoring the ReplayGain analysis). The latter has the benefit that the ReplayGain setting will work even in players that do not support ReplayGain. The disadvantage of the latter method is that it “could” cause some peaks to exceed 0 dB and be clipped. If Metadata tags have been used, then the original audio data will be read correctly (because it has not been altered by ReplayGain).

In the case of WAV files, ReplayGain tags are not supported and WAV files do not have a “gain” setting, so the only way to apply a ReplayGain loudness is for the scanner to amplify the audio data - this process is not lossless - if the loudness is set too high then the WAV file is permanently damaged.

In the case of Flac, Ogg, and most (all?) other formats that support ReplayGain, Metadata tags are written, which is a lossless process (the actual audio data is not changed in any way).

Having a ReplayGain “please make it louder” instruction applied to it

[and “pumped too much” would be when a clipping occurs]

Yes, that’s how I understand it

This statement makes it more clear. And I should have know this already, because now I remember seeing such a tag field somewhere in the past

Until know I only knew about the first method. I did not expect the second to be even existing

That is very clear

And so: Sound Forge instead of ignoring the ReplayGain value written as a tag to an MP3 file, applies it to such a file when it is loaded. Aut that I can already menage by using MP3Gain, before Sound Forge

But the real question that I’m after still remains: when encoding FLAC to WAV, does 4dots Free Audio Converter and Switch Sound File Converter behave the same as Sound Forge [not ignoring ReplayGain value written as tag]? Or did the creators of them took different [more logical] approach of processing the original [not pumped up] audio data; so that what comes out of them is “WAV = FLAC” and not “WAV = FLAC + ReplayGain”? But that is a question is for them

But even if I got an answer from them, I would have to get it again from other creators if I would choose to use yet another converter in the future

And so, a more universal approach would be to: wipe out all tag fields [as a precaution] before converting FLAC to WAV for editing purposes?
Analogical to what I do today with my MP3s: lowering [most of the time not existing] ReplayGain before sending them to Sound Forge for editing, and thus making sure that they have no clipping

Because this method would work for any converter, even those that are not existing today

But how do I do that?

If I use for example Mp3tag that operates on ID3 and APE, how can I know that some more metadata is not stored in some other way?

This article do not even mention of ID3 and APE usage- so how can I know [using Mp3tag] that a FLAC file does not have some more metadata attached to it? Are there some methods of audio metadata storage than APE and / or ID3?

Here are the answers:

Switch Sound File Converter 4.35 and 4dtos Free Audio Converter 3.1 when encoding FLAC to WAV do not take into account ReplayGain [at least in form of “REPLAYGAIN_TRACK_GAIN” and “REPLAYGAIN_ALBUM_GAIN”]. They will produce pure audio with no changes taken from ReplayGain

But Switch Sound File Converter and 4dtos Free Audio Converter will take into account ReplayGain applied via MP3Gain software to LAME coded MP3 file. They will produce permanently damaged WAV files [if that ReplayGain made clippings]

And it seems that also also Sony Sound Forge 11 loads up FLAC files without ReplayGain info, just as Audacity does. So it seems that this is rather universal approach: to leave ReplayGain out of FLAC when it is edited / processed

If someone can debunk those claims, because I misunderstood all those inner workings and made some tests in a wrong way, please tell. Or confirm my statements