Help - Search - Members - Calendar
Full Version: ReplayGain values for WavPack images and MP3 tracks
Hydrogenaudio Forums > Hydrogenaudio Forum > General Audio
steve3386
I am ripping my CD collection to WavPack images and LameMP3 tracks (using EAC with REACT2).

1) Is there a difference between calculating the ReplayGain values using a) wavegain on the .wav file before compression, b) wvgain on the .wv image file, and c) mp3gain (or some other program) on the mp3 files, or are these all just different implementations of the same algorithm?

2) I want the album gain written to the WavPack image file, and both the album and track gains written to the MP3 files (without applying any gains to the files -- no scaling). What is the best way to accomplish this? Can it be achieved in one run of one of the replay gain executables at some point in the process? Or do I have to run the calculation twice to get both album and track values? (If I can get the values, I can save them and then later write them to the files using REACT2.)

3) What is the easiest way to have my Ipod use the ReplayGain album values for its soundcheck values? I have a PC.
DrazardX
1) Yes, the values will be different.

2) I use split tracks for WavPacks, so to transfer the RG values to MP3s I simply copy the APEv2 tags using David Bryant's copytags.exe and a batch file. I create the original RG values with WavPack's RG scanner using Multi-frontend.

3) I can't help you here. I don't have an iPod.
davelasker
QUOTE (steve3386 @ Apr 18 2007, 01:10) *
3) What is the easiest way to have my Ipod use the ReplayGain album values for its soundcheck values? I have a PC.


You can accomplish #3 by using mp3gain to actually alter the volume of your mp3 files. Make sure you have soundcheck turned off if you try this.

Or else you could try foo_pod/foo_dop (iPod plugins for foobar 2000). These convert replaygain tags to iTunes/iPod volume adjustments.

Dave
Dynamic
QUOTE (steve3386 @ Apr 18 2007, 09:10) *
I am ripping my CD collection to WavPack images and LameMP3 tracks (using EAC with REACT2).

1) Is there a difference between calculating the ReplayGain values using a) wavegain on the .wav file before compression, b) wvgain on the .wv image file, and c) mp3gain (or some other program) on the mp3 files, or are these all just different implementations of the same algorithm?


They all use the same algorithm, but © would be applying that algorithm to different data (because mp3 is lossy).

To clarify, because the PCM data in the WAV and WV files are the same, both a) and b) should produce the same RG values and peak values - something you can test. However, c) - whether by mp3gain or foobar2000 - is analysing the lossy-compression output which will differ slightly and whose peak values are almost certainly higher than those of a) and b), usually by around 10% to 15%. The ReplayGain value in c) will not be audibly different from the value in a) or b).
steve3386
OK, so there is a difference between calculating the ReplayGain values using wavegain, wvgain, and mp3gain. Is it that: a) one of these programs calculates the ReplayGain values more accurately than the others, so that I should use that program to calculate RG values and copy these same values to both the WavPack and MP3 formats; or b) each of these programs is best for calcualting the RG values for its format, so that I should use wvgain to calculate the RG values for the WavPack image and mp3gain to calculate the RG values for the MP3 tracks.? I'm just trying to figure out the best way to calculate the RG values for these two formats.

Also, is MP3 gain the best or only program for use on MP3 files?

And, can any of these programs calculate both the album and track RG values at the same time, or will I have to run the program twice for that?
Dynamic
I believe they all use the exact same algorithm for calculating ReplayGain, but the implementations may differ to an utterly unimportant degree (e.g. rounding error). All of them can calculate Track and Album Gain at the same time providing you have the whole album available (not the case if your REACT config doesn't rip all tracks first before calculating RG).

However, anything analyzing the decoded MP3 (lossy, differs from the exact CD data) is looking at different data to anything analyzing the decoded lossless WV or the PCM WAV (both lossless, bit-identical copies of the CD data). For example, install foobar2000 and load the same song or album in the three formats in turn. Select the tracks of the album and use right-click "context" menu to scan for ReplayGain. Foobar2000 uses the exact same algorithm to determine the ReplayGain value whatever the format, so WAVE and Wavpack Lossless will produce identical results. MP3 will also be very close, and will only differ by an inaudible amount, so it really doesn't matter. All algorithms will produce the correct peak-levels.

Both foobar2000 and mp3gain produce perfectly good ReplayGain values. Both are capable of modifying the actual volume of the mp3 file without re-encoding by adjusting the global gain fields (in 1.5 dB steps, which is quite adequately fine) as well as storing tags (which allow ReplayGain-aware players to adjust further or switch between Album and Track Gain). If you adjust the actual volume like this (great for portables and car mp3 players without ReplayGain support), mp3gain will add Undo tags to be used should you ever need to return to the original loudness, but I don't think foobar2000 provides Undo. Foobar2000 can also apply Replaygain in its converter to modify the data going into an encoder like LAME, which was once shown to reduce sfb21 bitrate bloat for VBR files (at the then equivalent to -V2) in an older version of LAME.
greynol
That's a great explanation.

I'd add that mp3gain keeps the original replaygain values in an APE tag (along with all the other pertinent information) even after the file has been modified. In the case where a player is using the replaygain values stored in the APE tag, replaygain will have essentially been performed twice. Also, replaygain information in the Lame header is also left alone by mp3gain.

If you're going to use replaygain on mp3 files that have been modified using mp3gain, make sure you scan them (with a program other than mp3gain) after they've been modified. I don't know what players use RG information in a Lame header, but I'd avoid using them when also using mp3gain to modify the data.
Alex B
QUOTE (greynol @ Apr 20 2007, 22:01) *
I'd add that mp3gain keeps the original replaygain values in an APE tag (along with all the other pertinent information) even after the file has been modified. In the case where a player is using the replaygain values stored in the APE tag, replaygain will have essentially been performed twice. ...

Sorry, greynol, but that's incorrect.

MP3gain adjusts also the tag values accordingly if it is allowed physically adjust the file volume level.

Let's assume that the measured value is -6.5 dB and only the tag is written, then mp3gain writes that value to the tag.

If Mp3gain also adjusts the file volume -6 dB, then only the remaining -0.5 dB is saved in the APE tag. The peak value is adjusted similarly. In addition MP3 gain saves the undo info into a separate tag.

You can easily verify this by loading a tagged only file and an adjusted file to foobar or mp3tag and checking the values or by opening the files with a hex editor.

This is for the GUI version, but I assume that the command line program is not any different.


EDIT

However, Mp3gain does not read or write ID3 tags. So, if the original values are scanned with some other program and saved in the ID3v2 tag then they will remain unaltered after the file volume is changed with Mp3gain.

In that case it would be better to use foobar for changing the volume because it adjusts the ID3v2 tags correctly. Another option is to remove the replay gain tags with foobar before Mp3gain is used.

Unfortunately foobar doesn't have all tools that are available in Mp3gain. It would be great if someone would combine the Mp3gain tools and foobar's scanning speed (on a dual core PC) & ID3v2 tag writing in a single new tool.


EDIT 2
QUOTE
I don't know what players use RG information in a Lame header, but I'd avoid using them when also using mp3gain to modify the data.

IMO, it's better to always use the --noreplaygain LAME switch. I don't know any tool that can change this LAME header value afterwards.
greynol
QUOTE (Alex B @ Apr 20 2007, 13:34) *
QUOTE (greynol @ Apr 20 2007, 22:01) *
I'd add that mp3gain keeps the original replaygain values in an APE tag (along with all the other pertinent information) even after the file has been modified. In the case where a player is using the replaygain values stored in the APE tag, replaygain will have essentially been performed twice. ...
Sorry, greynol, but that's incorrect.

MP3gain adjusts also the tag values accordingly if it is allowed physically adjust the file volume level.

[...]

EDIT

However, MP3gain does not read or write ID3 tags. So, if the original values are scanned with some other program and saved in the ID3v2 tag then they will remain unaltered after the file volume is changed with MP3gain.

In that case it would be better to use foobar for changing the volume because it adjusts the ID3v2 tags correctly. Another option is to remove the replay gain tags with foobar before Mp3gain is used.

Unfortunately foobar does not not have all tools that are available in Mp3gain. It would be great if someone would combine the Mp3gain tools and foobar's scanning speed (on a dual core PC) & ID3v2 tag writing in a single new tool.

Ok, thanks! MP3Gain does modify all the pertinent fields in the APE tag after modifying the data. smile.gif

Nonetheless, if you're relying on a program that reads from and applies replaygain information to areas other than APE tags, make sure you analyze your files after they've been modified by mp3gain; if you choose to still use mp3gain.

Personally, I much prefer mp3gain over fb2k when it comes to modifying the audio data but would welcome a new tool like the one you've specified.


QUOTE (Alex B @ Apr 20 2007, 13:34) *
IMO, it's better to always use the --noreplaygain LAME switch. I don't know any tool that can change this LAME header value afterwards.
I agree! Doesn't this also speed the encoding up a bit, or is the possible speed increase insignificant?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.