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: Remove ReplayGain tags without removing MP3Gain tags (Read 8207 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Remove ReplayGain tags without removing MP3Gain tags

I am using foobar2000 v1.2.6.

I would like to use foobar to "remove ReplayGain information from files" without "removing MP3Gain information from files", is this possible?

There is good reason for this. I have a library of FLACs (ReplayGained) and MP3s (MP3Gained to 95db [MP3Gain also adds ReplayGain info automatically]).
I would like to use the setting: Preferences > Playback > Preamp "With RG info:" set to +6.1db in order to bump up my FLAC files from 89db to 95db (to match my MP3s).
But when I use this setting it gains the MP3s twice, once from MP3Gain (in the global gain field in each frame header) and again in the foobar preamp, because it has ReplayGain info.

I understand if I just use ReplayGain and do not use MP3Gain it will sort this out in foobar, but I like Mp3Gain as it works on all applications, not just foobar.
I also understand that I can just use the current "remove ReplayGain information from files", but unfortunately this also removes the MP3Gain info too. This means I have to reanalyze all me MP3s when I want to adjust their gain within MP3Gain.

If I can just remove the ReplayGain info, without touching the MP3Gain info then I can do the following:
Preferences > Playback > Preamp "With RG info:" +6.1db
Preferences > Playback > Preamp "Without RG info:" 0db
Both my FLACs (and other ReplayGained non MP3 files) will playback at 95db and my MP3Gained MP3s will playback at 95db.

I know MP3Tag quite well, so if I can do this from the tags manually, this could also be a solution.
EDIT: I just confirmed something to myself by removing the APE tag from the MP3, but this removes both ReplayGain and MP3Gain data.
EDIT2: I was able to achieve what I wanted in MP3Tag (v2.55) by:
  • Allowing 'write' permissions for APEv2 tags in the "Options" menu and
  • Using the 'Remove fields" with this as the parameter: "REPLAYGAIN_ALBUM_GAIN; REPLAYGAIN_ALBUM_PEAK; REPLAYGAIN_TRACK_GAIN; REPLAYGAIN_TRACK_PEAK"
I hope this helps someone else in the future.
[/b]

I did search first.
Any help? Cheers!

Remove ReplayGain tags without removing MP3Gain tags

Reply #1
I couldn't edit my lost post again sorry.

Even though I managed to remove the ReplayGain info while keeping the MP3Gain info, the above posts instructions should be ignored, as they do not achieve anything beneficial.
MP3Gain will still reanalyze an MP3 file (I assume because the ReplayGain info is missing) even when the MP3Gain info is maintained.
Undoing MP3Gain changes can still be achieved even when both the ReplayGain info and MP3Gain info is removed (from the APE tag).
The "remove ReplayGain info from files" action in foobar can be used to achieve this.

Alas, there is no solution to my problem, only the original work around.

Remove ReplayGain tags without removing MP3Gain tags

Reply #2
I see you have acknowledged this in one instance, but elsewhere you suggest otherwise, so to be clear for readers: There is no such thing as an “MP3Gain tag”. Data from MP3Gain is not stored in the APE tag. The calculated adjustments are stored in the global gain scale factor of each frame, quantised to the nearest 1.5 dB.

Details of why MP3Gain performs reanalysis when normal ReplayGain data are missing seems to remain a valid question, though.

Remove ReplayGain tags without removing MP3Gain tags

Reply #3
Um, MP3Gain info is stored in the APE tag, I can see them in MP3Tag, along with the ReplayGain info too.
That info can also be added to the global gain field in each frame header as well.


But I'm not sure it has to reanalyze when the ReplayGain info is missing as well...

Remove ReplayGain tags without removing MP3Gain tags

Reply #4
Sorry, you are right to point out the undo info, which is obviously important. But the entire reason that MP3Gain works across all players is that the gain is applied during playback using the global scale-factor, not any metadata field. It is for this exact reason that if you apply MP3Gain but then delete the tag and thus the undo info, the following applies:
Quote
IMPORTANT
If you choose the "Options - Tags - Ignore" option, then you will not be able to automatically undo changes made by MP3Gain. You will still be able to undo any changes, but you will have to manually keep track of what changes you make to your files.
Presumably the version in the tag is simply the original, more accurate version of the computed adjustment. Do any players even care about this?

Can you or anyone else confirm that the option to remove gain data in foobar2000 actually reverts the global gain factor in each frame? If not, the behaviour you requested might already be what is happening. In any case, some clarification from someone in-the-know would be good here.

Also, regardless, perhaps there should be an option to prefer normal ReplayGain exclusive-or MP3Gain info.

Remove ReplayGain tags without removing MP3Gain tags

Reply #5
Quote
But the entire reason that MP3Gain works across all players is that the gain is applied during playback using the global scale-factor, not any metadata field.

I understand that it changes the global scale-factor so all players benefit, and that's why I want to keep using MP3Gain, not just revert to using ReplayGain just so it works in foobar.

Quote
Can you or anyone else confirm that the option to remove gain data in foobar2000 actually reverts the global gain factor in each frame?

I know that this option in foobar does not revert the global gain factor in each frame header, it simply removes all ReplayGain info and MP3Gain info from the APE (I believe it does not delete the APE tag either).

Quote
perhaps there should be an option to prefer normal ReplayGain exclusive-or MP3Gain info.

This may be beneficial to other people, yes, that's why I raised it.
But for me, I want all players to benefit from MP3Gain. But then foobar and Rockbox to use ReplayGain preamp (+6.1db) for my FLACs and MP3Gain global scale-factor for my MP3s, with no preamp (0db). So I need to delete the ReplayGain info from my MP3s, so foobar )and Rockbox) can differentiate between an MP3 and other formats.
I just can't seem to delete ReplayGain info from the tag and keep MP3Gain info in the tag accurately.
And even so, I don't know if this info is needed for MP3Gain to undo changes (I only assume it needs it). Can someone confirm this please?
Is keeping the MP3Gain tag info beneficial for anything?
I will have to keep playing later on today.

Remove ReplayGain tags without removing MP3Gain tags

Reply #6
Quote
Can you or anyone else confirm that the option to remove gain data in foobar2000 actually reverts the global gain factor in each frame? If not, the behaviour you requested might already be what is happening. In any case, some clarification from someone in-the-know would be good here.


The "Remove ReplayGain info from files" option does not revert the global gain factor in each frame of MP3 files.
It does however remove all info in the APE tag:
  • MP3GAIN_ALBUM_MINMAX
  • MP3GAIN_MINMAX
  • MP3GAIN_UNDO
  • REPLAYGAIN_ALBUM_GAIN
  • REPLAYGAIN_ALBUM_PEAK
  • REPLAYGAIN_TRACK_GAIN
  • REPLAYGAIN_TRACK_PEAK
Although this does result in the behaviour I want, it means that I am forced to reanalyze next time in MP3Gain and also means that I have lost the undo info.
The former I can live with, the latter I don't think is such a good idea.

I have done some investigating and found the following:

When running an "Analysis" option in MP3Gain (v1.2.5), the following info is added to the APE tag, which is then added to the MP3 file:
  • MP3GAIN_ALBUM_MINMAX
  • MP3GAIN_MINMAX
  • REPLAYGAIN_ALBUM_GAIN
  • REPLAYGAIN_ALBUM_PEAK
  • REPLAYGAIN_TRACK_GAIN
  • REPLAYGAIN_TRACK_PEAK

When running a "Gain" option in MP3Gain (v1.2.5), the following info is added to the APE tag, which is then added to the MP3 file:
  • MP3GAIN_ALBUM_MINMAX
  • MP3GAIN_MINMAX
  • MP3GAIN_UNDO
  • REPLAYGAIN_ALBUM_GAIN
  • REPLAYGAIN_ALBUM_PEAK
  • REPLAYGAIN_TRACK_GAIN
  • REPLAYGAIN_TRACK_PEAK

The only way of knowing if an MP3 file has been gained (from the tag info), is if the "MP3GAIN_UNDO" field is present.
I assume that players (including foobar) do not know from looking at the MP3 itself (not the tag info), that an MP3 has been gained. Is this correct?
Or can they look at the global gain factor in each frame header of the MP3 and tell that it has been gained?
Can anyone clarify this for me?

  • If the former is true, then the only way for MP3s not to get gained twice (once in from the global gain factor and twice from the preamp), is for players to look for the "MP3GAIN_UNDO" field, and then either preamp if the field isn't present or not preamp if the field is present.
  • If the latter is true, then players should ignore ReplayGain info if MP3s have been MP3Gained (ie: the global gain factor has been modified).

At least one of the two points above would have to be implemented into every player that can understand ReplayGain and has a preamp.
Perhaps foobar could add the following and other players may follow suit?
A checkbox under Preferences > Playback > Preamp: "Do not preamp MP3Gained MP3 files"


Additional information
MP3Gain needs the following in order not to have to reanalyze:
  • REPLAYGAIN_ALBUM_GAIN
  • REPLAYGAIN_ALBUM_PEAK
  • REPLAYGAIN_TRACK_GAIN
  • REPLAYGAIN_TRACK_PEAK

MP3Gain needs the following in order to undo it's changes:
  • MP3GAIN_UNDO

So I can achieve what I want by just deleting the following info:
  • REPLAYGAIN_ALBUM_GAIN
  • REPLAYGAIN_ALBUM_PEAK
  • REPLAYGAIN_TRACK_GAIN
  • REPLAYGAIN_TRACK_PEAK

and by keeping the following:
  • MP3GAIN_ALBUM_MINMAX
  • MP3GAIN_MINMAX
  • MP3GAIN_UNDO

This means I only have to reanaylze (not very often so I can live with this) each time I want to change the db, but still means I can undo all of MP3Gain's changes.
I will have to talk to Florian about how to get MP3Tag to just delete these four ReplayGain fields, while keeping all my other tags in tact, as I can't seem to achieve this just yet.

Hope this may help someone in the future...
Any more help on this would be much appreciated!

Remove ReplayGain tags without removing MP3Gain tags

Reply #7
Can I please request that:
Foobar2000 will only remove 'ReplayGain info' and not 'MP3Gain info' when using the option "Remove ReplayGain information from files".

Remove the following fields from the APE tag:
REPLAYGAIN_ALBUM_GAIN
REPLAYGAIN_ALBUM_PEAK
REPLAYGAIN_TRACK_GAIN
REPLAYGAIN_TRACK_PEAK

Do not remove the following fields from the APE tag:
MP3GAIN_ALBUM_MINMAX
MP3GAIN_MINMAX
MP3GAIN_UNDO

I cannot see why foobar2000 should remove the 'MP3Gain info'.
The current effect is causing me problems when I want to undo MP3Gain's gain changes.

Thank you

Remove ReplayGain tags without removing MP3Gain tags

Reply #8
I can see why. But it should probably be split to a separate option to remove MP3Gain info only.

Remove ReplayGain tags without removing MP3Gain tags

Reply #9
Quote
But it should probably be split to a separate option to remove MP3Gain info only.

That would be perfect!
How can we submit this as a request? I posted it in the support forum, was this the right thing to do?

Quote
I can see why.

Can you please explain why?

Remove ReplayGain tags without removing MP3Gain tags

Reply #10
How can we submit this as a request?
You just did. Reposting it as a new thread was unnecessary; that will now be closed.

Quote
I posted it in the support forum, was this the right thing to do?
No. See the below stipulation from the rules of Support, which advertised at the top of each page therein.
Quote
"How to?" questions and feature requests should be posted to "General - (fb2k)".

Quote
Quote
I can see why.
Can you please explain why?
By a broad definition, ReplayGain info includes MP3Gain info. You are requesting that the definition be narrowed. Whilst I agree, that does not mean I think the current behaviour is particularly irrational.

However, I do think that it should revert the global gain field too, at least if undo info is present.

Remove ReplayGain tags without removing MP3Gain tags

Reply #11
Quote
"How to?" questions and feature requests should be posted to "General - (fb2k)".

Apologies.

Quote
However, I do think that it should revert the global gain field too, at least if undo info is present.

Maybe as a separate option, perhaps. But reverting the global gain field could really confuse things...

Maybe these options?
"Remove ReplayGain (not MP3Gain) information from files"
"Remove ReplayGain (all) information from files"
"Undo any MP3Gain gain changes and remove ReplayGain (all) information from files"

And maybe also the checkbox option to Preferences > Playback > Preamp:
"Do not preamp MP3Gained MP3s files"

These options should diffuse all future confusion.

Remove ReplayGain tags without removing MP3Gain tags

Reply #12
Quote
And maybe also the checkbox option to Preferences > Playback > Preamp:
"Do not preamp MP3Gained MP3s files"


Or even better, have 3 preamp sliders...

Preamp
For MP3Gained MP3's:
<-----------------------|----------------------->
For ReplayGained files (excluding MP3Gained MP3's):
<-----------------------|----------------------->
For all other files:
<-----------------------|----------------------->