Skip to main content


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: Converting ReplayGain'ed files (Read 4337 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Converting ReplayGain'ed files

I have my albums in encoded in FLAC. I will soon add ReplayGain info to them and store them on an external HDD. When I need to burn them to CD for the iMP player, I'll encode them to MP3 or Vorbis using the diskwriter.

What I want to understand: is there any difference between
  • just transcoding the ReplayGained FLAC using diskwriter (having the "use replaygain" option checked in settings)
  • transcoding a with without ReplayGain info and adding the info later.
I guessed there shouldn't be, but I did the following experient:
I made two identical files, one with replaygain and one without.
I encoded both with the "use replaygain" both ticked and not ticked (in cfg)
The result is four files (I know I did some extra unnecessary work but it was to be sure). Three of them are identical (those without RG). The file with RG info is significantly smaller (a few KiB's). The bitrate of that file is 1 less than the others (VBR file average). I'm worried because this may show a quality loss that I haven't noticed.

The reason for my preference of gaining the lossless instead of lossy files is that I won't have to do that for lossy files separately then.

Are files made with the first option same or similar to Mp3gain'ed files (compatible with anything)?

Another question: If I convert a ReplayGain'ed FLAC file from the command line, (oggenc with flac input support), will the resulting file have RG automatically? This would be a much preferred method because my real platforum is GNU. I have to use foobar2000 because I currently use single file per album (maybe I'll change).

Converting ReplayGain'ed files

Reply #1
There shouldn't be any audible difference between the two files.

Are files made with the first option same or similar to Mp3gain'ed files (compatible with anything)?

The files that you've encoded with replaygain enabled are of course going to have the same volume on all players, so I suggest that you stick to that method. In theory, there might be a very small loss of quality. In practice, I strongly doubt that anybody can notice it.

Converting ReplayGain'ed files

Reply #2
What you're seeing (a smaller file) is perfectly normal, and this is also the method I use.

When you have a FLAC file with replaygain info, and use the CLI encoder with "use replaygain" checked, the replaygain value will be applied when decoding the file. So basically the result is similar to applying Wavegain to the temporary WAV file before encoding to MP3 or Ogg Vorbis.

Here is an interesting thread about this process:

Make sure you understand that, when "use replaygain" is checked, it will not copy the replaygain values to the resulting file, but it will apply the replaygain value, thus making the temporary WAV file louder or quieter before encoding.

Considering the high volumes that are used in mastering nowadays, the WAV file will in almost all cases be quieter.

Therefor, when you play the resulting MP3 or Ogg Vorbis files in a player that has no replaygain support, the file that's created with "use replaygain" enabled will probably sound quieter than the others.

I actually like the way it works, because the resulting file will automatically play at the desired volume level, regardless of what player you use (whether it supports replaygain or not).

Also, since quieter music needs less bytes during encoding, the resulting file will be smaller. This is what you are seeing.

The only disadvantage this method has compared to using e.g. MP3Gain is the fact that the volume change is non-reversable. However, since you keep the original FLAC file, you could always easily recreate the MP3 or Ogg Vorbis file without replaygain if you want.
Over thinking, over analyzing separates the body from the mind.

Converting ReplayGain'ed files

Reply #3
Thank you both for answering. What you said is exactly as what I wished the case to be (making the temporary WAV file louder or quieter before encoding). For my last question (encoding without fb2k) I guess the answer is that ReplayGain info is discarded so I'll have to gain again (not a big problem).

Converting ReplayGain'ed files

Reply #4
It would make sense to carry the replay gain values (suitably modified) to the final file, at least for lossless files...

e.g. if the FLAC file had RG track = -8dB, RG album = -7dB, and you applied the album gain upon decoding, then the resulting file should logically have RG track = -1dB, RG album = 0dB. You could calculate the appropriate peak values too, and (if a common convention could be figured out) you could store the adjustment that had been made, so you could restore the tracks to the original loudness if required. (e.g. RG adjust = -7dB or something).

If you make lossy copies, then the true RG values may be slightly different. However, it's better to have "nearly" values than none at all. This is one reason I suggested storing the RG calculation method along with the RG data, but this has been largely ignored.

The peak values will be wrong after lossy encoding, but these could easily be calculated if required.

At the very least, when transcoding lossless>lossless with RG change, it could/should be possible to pass and convert the RG values, accounting for any pre-amp.

Just an idea.



Converting ReplayGain'ed files

Reply #5
Whose code or what process is being used in foobar2000 for the Diskwriter "use replaygain" option?  As was discussed in the aforementioned thread a while back, the best process would be to use an encoder's built-in scaling option if possible, not that one could tell the difference between this and a WavGain as such, but I am guessing that the latter is what foobar2000 is currently using.  Thanks

Edit:  Also, about 2Bdecided's idea, has this been implemented anywhere?
WARNING:  Changing of advanced parameters might degrade sound quality.  Modify them only if you are expirienced in audio compression!