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: foobar's replaygain value different from MP3Gain (Read 7382 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

foobar's replaygain value different from MP3Gain

I made a track gain analysis on a mp3 file with foobar2000 and another time with MP3Gain. Why do they get different values? Which application is more accurate?

foobar's replaygain value different from MP3Gain

Reply #1
Apples and oranges.  MP3Gain uses a special technique to alter the actual file in a lossless way, so that it will work on any player, whether or not ReplayGain is supported.  This method has limitations, not allowing it to get the exact value desired.  So it still uses a ReplayGain tag to make up the difference (which isn't a whole lot).  ReplayGain is an external solution that has no such limitations, so its value will almost always be different from MP3Gain's.

So I'm guessing that both methods ultimately provide the same results, albeit in different ways, even though their values are slightly different.

foobar's replaygain value different from MP3Gain

Reply #2
KarnEvil9,
I was not talking about altering the music data, just the tags. MP3Gain has a mode to analyze/write tags only.

foobar's replaygain value different from MP3Gain

Reply #3
Can you point to a help file or menu item that suggests it adds tags without altering the files themselves?  That's always been the point of MP3Gain, but maybe I missed an update.

foobar's replaygain value different from MP3Gain

Reply #4
just hit the "Track Analysis" button or go to the "Analysis" menu

foobar's replaygain value different from MP3Gain

Reply #5
http://wiki.hydrogenaudio.org/index.php?title=MP3Gain
Quote
Another difference with MP3Gain is the fact that it can only adjust physical volume in 1.5 dB steps.


the fb2k version of replaygain can store any in-between numbers, so they differ from the MP3 values in most cases (and are more accurate)

foobar's replaygain value different from MP3Gain

Reply #6
just hit the "Track Analysis" button or go to the "Analysis" menu

That still physically alters the MP3 file, rather than just adding tags.  Well, not the Analysis itself, but  when you act on it (Track Gain or Album Gain).  Analysis itself doesn't do anything other than provide info on screen.  And the info provided is based on MP3Gain's limitations for altering the MP3(s) (as GLiBERN detailed).  That's why it's different from ReplayGain, which has no such limitations, as pointed out.

foobar's replaygain value different from MP3Gain

Reply #7
http://wiki.hydrogenaudio.org/index.php?title=MP3Gain
Quote
Another difference with MP3Gain is the fact that it can only adjust physical volume in 1.5 dB steps.

the fb2k version of replaygain can store any in-between numbers, so they differ from the MP3 values in most cases (and are more accurate)

With the caveat that MP3Gain uses Replay Gain tags to make up for those differences, so their accuracy should be identical in foobar2000 and other players which have Replay Gain support.  Where MP3Gain shines is on players that have no such support.

foobar's replaygain value different from MP3Gain

Reply #8
Where MP3Gain shines is on players that have no such support.

Since foobar added this feature (right click - replaygain - apply album  replaygain to MP3 data) I have had no use for mp3gain any more.

foobar's replaygain value different from MP3Gain

Reply #9
Where MP3Gain shines is on players that have no such support.

Since foobar added this feature (right click - replaygain - apply album  replaygain to MP3 data) I have had no use for mp3gain any more.

Are you saying foobar now does the same volume modification trick as MP3Gain, so it will work in players that don't support Replay Gain?

If so, I may drop MP3Gain also...

foobar's replaygain value different from MP3Gain

Reply #10
sure it does, you can't undo it though
fb2k on OSX: flac q8 > rockboxed Sansa e280v1: Vorbis q5.0

 

foobar's replaygain value different from MP3Gain

Reply #11
MP3Gain can save only the Replay Gain tags without altering the gain in the files. The tags are in the APEv2 format.

RogerG, are you speaking about significant differences?

As a quick test, I analyzed a bunch of various MP3 files with MP3Gain and foobar2000. Here is a screenshot of the results (the values in the scan results window are from foobar):



Foobar and MP3Gain use a different MP3 decoder and also the math may be done in a slightly different way, but the differences in my results are not significant.

foobar's replaygain value different from MP3Gain

Reply #12
sure it does, you can't undo it though

Then I guess I'll be keeping around MP3Gain after all.

MP3Gain can save only the Replay Gain tags without altering the gain in the files. The tags are in the APEv2 format.

How so?

foobar's replaygain value different from MP3Gain

Reply #13
KarnEvil9, I guess you have disabled tag writing under Options > Tags or you are using an old version.

RogerG, are you speaking about significant differences?

Foobar and MP3Gain use a different MP3 decoder and also the math may be done in a slightly different way, but the differences in my results are not significant.


With my tested file the difference was just 0.02 dB. I thought that the replaygain algorithm was a standard so that all implementations would  produce the same results. Different decoder output would be an explanation. I didn't know that different decoders can produce different output.

foobar's replaygain value different from MP3Gain

Reply #14
These just look like rounding/precision errors, which you will run into anytime you are doing floating-point calculations on binary values. It's possible neither one is perfectly accurate. Does it matter? A 0.02 dB difference is surely inaudible. Can 16-bit PCM audio even be scaled to produce a change that small?

foobar's replaygain value different from MP3Gain

Reply #15
Just a side note: Even if no such small differences like 0.02 dB can be expressed with 16 bit audio, it might lead to different rounding, which then will produces the minimal difference possible.

foobar's replaygain value different from MP3Gain

Reply #16
KarnEvil9, I guess you have disabled tag writing under Options > Tags or you are using an old version.

No, those are the Replay Gain tags that supplement the inaccuracy of modifying the actual MP3 data.  They're also the tags that allow you to restore the MP3 file to its original state (in effect, making the change lossless).

I'm certainly not too proud to be proven wrong, but I've yet to see any evidence that MP3Gain has the option to write Replay Gain tags without modifying the actual MP3 data first.

foobar's replaygain value different from MP3Gain

Reply #17
I'm certainly not too proud to be proven wrong, but I've yet to see any evidence that MP3Gain has the option to write Replay Gain tags without modifying the actual MP3 data first.


The values on top of my sreenshot were written by MP3Gain to completely untagged files. It did not adjust the gains as you can see from the values that were analyzed by foobar.

To only write the RG tags:
1. Load the files to the MP3Gain GUI program.
2. Check that tag writing is not disabled in the options (i.e. that "Options > Tags > Ignore (do not read or write tags)" is NOT selected)
3. Press the Analysis button (in the album or track mode) or run album or track analysis from the Analysis menu.
=> MP3Gain will analyze the files and write the RG tags in the APEv2 format.


The Gain button in the album or track mode or a "Modify Gain" menu command will actually change the file gains and adjust the Replay Gain tag values accordingly to be correct for the changed files.

foobar's replaygain value different from MP3Gain

Reply #18
With my tested file the difference was just 0.02 dB. I thought that the replaygain algorithm was a standard so that all implementations would  produce the same results. Different decoder output would be an explanation. I didn't know that different decoders can produce different output.

Here's an interesting decoder test from the not-so-distant past: http://mp3decoders.mp3-tech.org/intro.html.

To see how current decoders work I just compared the decoded output of foobar and dBpoweramp. I converted two short MP3 files to 32-bit float wave. The resulting files do not contain identical audio data:

Code: [Select]
Differences found in 2 out of 2 track pairs.

Comparing:
"F:\Test\m1_fb2k.wav"
"F:\Test\m1_dbpa.wav"
Differences found: 804889 sample(s), starting at 0.0000000 second(s), peak: 0.0000006 at 2.2336961 second(s), 2ch

Comparing:
"F:\Test\m2_fb2k.wav"
"F:\Test\m2_dbpa.wav"
Differences found: 805515 sample(s), starting at 0.0000000 second(s), peak: 0.0000010 at 8.2026757 second(s), 2ch

The combined duration of one file pair is 882000 samples (10 + 10 s) so about 90% of the samples differ. However, these differences must be very small because this time they don't show up in a replay gain scan. The peak and dB values are identical for both decoders.

Another possible factor is gapless decoding. A gaplessly decoded file has always a slightly shorter duration and that may affect the result (at least in theory). Probably MP3Gain does not read the LAME info tag and apply gapless decoding.


Regarding the possible difference in the analyzer code, I think the same algorithm can be implemented in different ways so that the analysis results may differ slightly, but I am not an expert in this field.

foobar's replaygain value different from MP3Gain

Reply #19
I'm certainly not too proud to be proven wrong, but I've yet to see any evidence that MP3Gain has the option to write Replay Gain tags without modifying the actual MP3 data first.

The values on top of my sreenshot were written by MP3Gain to completely untagged files. It did not adjust the gains as you can see from the values that were analyzed by foobar.

To only write the RG tags:
1. Load the files to the MP3Gain GUI program.
2. Check that tag writing is not disabled in the options (i.e. that "Options > Tags > Ignore (do not read or write tags)" is NOT selected)
3. Press the Analysis button (in the album or track mode) or run album or track analysis from the Analysis menu.
=> MP3Gain will analyze the files and write the RG tags in the APEv2 format.

That's interesting.  Calling that command "Analysis" is an unfortunate term, since that suggests it's just analyzing and not actually making any changes to the files.  Personally, I always just go straight to Track Gain or Album Gain, to save a step, since I want the actual data to be changed (and reversible).

foobar's replaygain value different from MP3Gain

Reply #20
A 0.02 dB difference is surely inaudible.
True - and even a 0.1dB difference is usually inaudible. It's completely irrelevant if we're talking about level matching two different audio tracks.

Not to mention that ReplayGain is trying to calculate (guess!) a human subjective experience (what we call "loudness") - I don't think it's getting it correct to within 0.1dB

The algorithms should be the same, but the filer coefficients may be rounded differently in different implementations, and gapless vs not gapless decoding will cause some differences because ReplayGain process the audio in blocks - a little extra delay will move a few samples from one block into the next one, giving a slightly different result.

Cheers,
David.