HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: Pootle_1 on 2004-07-30 15:46:51

Title: Difference between Mp3gain and Replaygain
Post by: Pootle_1 on 2004-07-30 15:46:51
Replaygain and MP3Gain

I was confused about the differences between Replaygain and MP3Gain, so wrote this note explaining the difference.  I hope this is the correct forum, please move it if it would be better somewhere else.

I realise that the FAQ has a section "Replaygain: WaveGain vs. MP3Gain" but that doesn't obviously cover the features I describe below.

I illustrate the difference by describing adjustment of playback volume using MP3Gain and Foobar2000 (a Replaygain-aware MP3 player). I'm assuming the reader is familiar with the priciples behind Replaygain.

------------------------------------------------------------------------- -

An MP3 file is composed of many blocks of audio, one after the other. Each block corresponds to a few milliseconds of music. Each block has a global gain field which tells an MP3 file player how loud to play that block.  In addition to these global gain fields, each MP3 file can also have a Replaygain header which applies to the whole file, and which tells a Replaygain-aware MP3 player how loud to play that file.

MP3Gain determines the Replaygain values for the MP3 file. MP3Gain then writes to the global gain header of every block, adjusting them all up or down by the same amount in order to achieve those Replaygain values.  MP3Gain also writes a Replaygain header which applies to the whole MP3 file. Since MP3Gain has adjusted the global gain field for each block to give the right volume, the volume adjustments in that Replaygain header will be small.  This MP3 file will then play at the right volume in all players, whether or not they are Replaygain-aware.

Foobar2000 doesn't write to the global gain field of individual blocks. It determines and writes only the Replaygain header which applies to the whole MP3 file.  The value it writes to the Replaygain header will therefore be different to that written by MP3Gain since each block is left with it's original global gain field setting.

It is potentially easy to screw this up.

For example, let's say we have a file which is VERY LOUD. We use Foobar2000 to adjust the Replaygain header, which of course writes a value which tells a Replaygain-aware player to turn everything down a lot.

Now suppose we use MP3Gain to adjust the playback volume. And suppose that this time MP3Gain is set to IGNORE tags in the file (i.e. "Options" > "Tags" > "Ignore (do not read or write tags)" is checked). It will still adjust the global gain field of each block (and turn them all down), but it will ignore the Replaygain header, i.e. leave it at the setting which Foobar2000 used.

If we then play our MP3 file in a player which is NOT Replaygain-aware, everything will be fine - the MP3 file will play at the right volume because the global gain field for each individual block has been turned down.

BUT what happens if we then play the MP3 file in an Replaygain-aware player? Now the file will be played much too quietly because the global gain field settings for each block have been turned down AND the Replaygain header for the whole MP3 file is still telling the player to turn down the whole file.

The safest solution to all this is to make sure that if you use MP3Gain on your files, it is NOT set to ignore tags in the file. Then it won't matter which you use to adjust the Replaygain (Foobar2000 or MP3Gain, in any order) since either will set the value of Replaygain correctly.

Edit:  Correction. Since I wrote the above paragraph I have got to know foobar2000 better.

There are several different types of headers (usually called "tags") which hold information about an MP3 file - two of the most common are ID3 and APE.  Most MP3 taggers and CD rippers use ID3 tags to hold artist information.  MP3Gain uses APE tags to hold MP3Gain and Replaygain information.

Because foobar2000 ignores ID3 tags if it finds an APE tag, it is better NOT to let MP3Gain add tags to MP3 files if you intend to use foobar2000 as your MP3 player.  If you do let MP3Gain write tags, you will find that foobar2000 will not display Artist/Album/Track etc correctly unless that information is also in the APE tag.  Since most MP3 taggers use the ID3 tags to store that information,  it will almost certainly not be displayed.

You will lose very little by not letting MP3Gain write tags - each individual block of music has had it's global gain header adjusted so it will always play correctly to within 1.5dB (MP3Gain's accuracy).  To set MP3Gain to not write tags to the file make sure "Options" > "Tags" > "Ignore (do not read or write tags)" is NOT checked.  MP3Gain can also remove tags which it has previously added.  If you want the ReplayGain correction to be exact, you can use foobar2000 to adjust the ReplayGain.  foobar2000 can be configured to write ReplayGain values to ID3 tags so any previously-stored Artist/Album/Track information is not lost.

The above correction may not apply to players other than foobar2000.

------------------------------------------------------------------------- -

Note that the advantage of using MP3Gain is that the global gain header for each block MUST be supported by all MP3 players, hardware or software.  The Replaygain header is not supported by all players.
Title: Difference between Mp3gain and Replaygain
Post by: Pio2001 on 2004-07-30 18:52:57
Experts, do you confirm the above ? Can I include it in the FAQ ?
Title: Difference between Mp3gain and Replaygain
Post by: Garf on 2004-07-30 18:58:52
IIRC it's not a 'global gain header' but a 'global gain field' in each frame header.

Also

Quote
This Replaygain header tells a Replaygain-aware player the gain settings which apply to the WHOLE FILE so that - in conjunction with the many global gain settings which MP3Gain has just written - the MP3 is played at the right volume.


The wording doesn't make it clear the Replaygain header doesn't necessarily be supported for the file to still sound right.
Title: Difference between Mp3gain and Replaygain
Post by: singaiya on 2004-07-30 19:45:37
IIRC, I had problems with mp3gain screwing up my tags when I set it to not ignore them.

For example, I'd ripped and encoded a CD in EAC which correctly tagged the mp3 files. Then I ran mp3gain album mode on them (set to not ignore tags). Loaded them into fb2k and the tags were gone, thus having to use masstagger to set them.

On the next CD rip/encode I did everything the same except told mp3gain to ignore tags, and then the tags were recognized when loaded into fb2k.
Title: Difference between Mp3gain and Replaygain
Post by: saratoga on 2004-07-30 21:53:06
Quote
IIRC, I had problems with mp3gain screwing up my tags when I set it to not ignore them.

For example, I'd ripped and encoded a CD in EAC which correctly tagged the mp3 files. Then I ran mp3gain album mode on them (set to not ignore tags). Loaded them into fb2k and the tags were gone, thus having to use masstagger to set them.

On the next CD rip/encode I did everything the same except told mp3gain to ignore tags, and then the tags were recognized when loaded into fb2k.
[a href="index.php?act=findpost&pid=230400"][{POST_SNAPBACK}][/a]


It didn't exactly mess up your tags; it actually didn't touch them.  Rather it appended an additional APEv2 tag to the end of your file with the gain info.  Foobar does not support mixing APEv2 and ID3v2 tags, so it ignored the ID3v2 tags and read the APEv2.

One solution would be to use APEv2 tags on your files.
Title: Difference between Mp3gain and Replaygain
Post by: singaiya on 2004-07-30 22:11:34
But the thing is, I've never used ID3v2; I've always had EAC use v1.1.  Regardless, I'll give it a try again when I'm at home to verify it.

I don't know that EAC can add APE tags. Can it?
Title: Difference between Mp3gain and Replaygain
Post by: Hanky on 2004-07-30 23:14:18
I can confirm this behaviour when using this procedure, EAC adds id3v1.1 tags, mp3gain adds APEv2 tag to store undo info, Foobar2000 doesn't display any tags, but Winamp does. The id3v1.1 tags are still there. If I tell mp3gain to remove all tags it added, the problem is solved. Perhaps there is a way to tell Foobar to ignore APEv2 tags and only read id3v1.1 tags instead.
Title: Difference between Mp3gain and Replaygain
Post by: Raja on 2004-07-31 08:27:48
I can confirm that using only APE tags will solve this dilemma.  If you rip a CD with EAC to MP3 and choose NOT to tag them, you can safely mp3gain or masstag the files via foobar in any order you please and the information will be written, displayed, and played correctly.

This is will the ignore tags option of mp3gain left unchecked.
Title: Difference between Mp3gain and Replaygain
Post by: /\/ephaestous on 2004-07-31 08:52:26
To solve this problem you can:

A) Use foobar2000 to calculate the RG info and then apply it on mp3gain
or
B) Scan the files and apply the gain in p3gain then use tag.exe to write ape2 tags and delete the unneeded id3v1 tags.
Title: Difference between Mp3gain and Replaygain
Post by: Pootle_1 on 2004-08-02 10:35:48
I've edited my original post in response to some of the comments here.  I'm glad if it proves useful.

I realise that there are other issues with MP3Gain and Replaygain.  For example, the Replaygain header always allows track OR album gain to be selected in your MP3 player, but if MP3Gain is set to ignore tags then it is necessary to make this decision beforehand.  And then there are the tagging problems discussed above.

The purpose of my post was to describe the differences between volume adjustments as implemented by Replaygain and MP3Gain as I couldn't find that information elsewhere.
Title: Difference between Mp3gain and Replaygain
Post by: Pootle_1 on 2004-08-23 17:11:53
Added a correction concerning ID3/APE tags after poking foobar2000 with a sharp stick for a few weeks.
Title: Difference between Mp3gain and Replaygain
Post by: rfarris on 2004-08-23 17:50:24
Quote
Since MP3Gain has adjusted the global gain field for each block to give the right volume...
I assume that each block is scaled by an identical value?  Is that true?  If so, you might want to explicitly state it, to avoid questions like this one.  :-)

(n.b. When the blocks are scaled with non-identical scale factors, it is called "compression.")
Title: Difference between Mp3gain and Replaygain
Post by: Pootle_1 on 2004-08-23 20:58:19
Quote
I assume that each block is scaled by an identical value?  Is that true?

Thanks for your advice.

I want to be careful with wording here.  I don't know if the value in the global gain headers are logarithmic or linear, so "scaling" might not be quite the right word.  I also don't want to mention decibels etc etc too much - I want to keep it as plainly-worded as possible.  I know I have just added a mention of 1.5dB in my recent edit.

I've edited the 4th paragraph to say: "MP3Gain then writes to the global gain header of every block, adjusting them all up or down by the same amount in order to achieve those Replaygain values."

Do you think this sums up your suggestion without being technical?
Title: Difference between Mp3gain and Replaygain
Post by: dreamliner77 on 2004-08-24 04:24:21
Quote
To solve this problem you can:

A) Use foobar2000 to calculate the RG info and then apply it on mp3gain
or
B) Scan the files and apply the gain in p3gain then use tag.exe to write ape2 tags and delete the unneeded id3v1 tags.
[a href="index.php?act=findpost&pid=230512"][{POST_SNAPBACK}][/a]


B is essentially what I do.  Perhaps it would be possible to ask Glen to add an option to copy ID3 fields to ape in the next mp3gain release?
Title: Difference between Mp3gain and Replaygain
Post by: rfarris on 2004-08-24 19:32:59
Quote
Quote
I assume that each block is scaled by an identical value?  Is that true?

I've edited the 4th paragraph to say: "MP3Gain then writes to the global gain header of every block, adjusting them all up or down by the same amount in order to achieve those Replaygain values."

Do you think this sums up your suggestion without being technical?
[a href="index.php?act=findpost&pid=236513"][{POST_SNAPBACK}][/a]

Absolutely!  Thanks for taking the comment in the spirit it was offered.

-- Rick
Title: Difference between Mp3gain and Replaygain
Post by: magic75 on 2004-08-25 08:26:15
Quote
Perhaps it would be possible to ask Glen to add an option to copy ID3 fields to ape in the next mp3gain release?

Or maybe ask fb2k developers to improve the tag reading? Seems a bit more logical to me. Fb2k is an excellant player, but why can't it handle tags that are not in sync? I asked once in the fb2k forum, but never got an answer unfortunately.
Title: Difference between Mp3gain and Replaygain
Post by: kwanbis on 2004-09-03 23:41:31
i still have some doubts ...

on mp3gain, to what tags it refers on Options/Tags? Glogal (mp3gain) or Frame?

If Global,

"Options" > "Tags" > "Ignore (do not read or write tags)"
would make mp3gain ignore foobar's correction, which is the oposite we want

"Options" > "Tags" > "Recalculate (do not read tags)"
would make mp3gain recalculate the global tag, after computing the frame ones, which we would like

"Options" > "Tags" > "Don't check while adding files"
it would do as if the file has never been gained, either glogally, or by frame?

i allways used MP3gain, and have no problem with foobar reading my tags ... so i don't get this also.

and what should i do, if i want to apply mp3gain to my files, and play them throug fb2k (but not use fb2k gain calculus)?
Title: Difference between Mp3gain and Replaygain
Post by: kwanbis on 2004-09-06 17:36:19
UP the question!
Title: Difference between Mp3gain and Replaygain
Post by: Pootle_1 on 2004-09-07 09:09:45
Quote
i still have some doubts ...

on mp3gain, to what tags it refers on Options/Tags? Glogal (mp3gain) or Frame?

Global

Quote
If Global,

"Options" > "Tags" > "Ignore (do not read or write tags)"
would make mp3gain ignore foobar's correction, which is the oposite we want

That's right.

Quote
"Options" > "Tags" > "Recalculate (do not read tags)"

would make mp3gain recalculate the global tag, after computing the frame ones, which we would like

That's right.

Quote
"Options" > "Tags" > "Don't check while adding files"
it would do as if the file has never been gained, either glogally, or by frame?

Reading the Help file, with this option MP3Gain doesn't read the tags for each file while it is adding the files, but would read them later when it came to correct the gain for each file.

The end result will be exactly the same as if NO options are checked, but the files will load faster when a directory is selected.

Quote
i allways used MP3gain, and have no problem with foobar reading my tags ... so i don't get this also.

Great!  There's a couple of reasons why this might happen (a) because you have MP3Gain set to "Ignore (do not read or write tags)" or (b) because your MP3 Artist/Album/Track etc information is stored in APE tags, not ID3 tags.  So when Foobar finds the APE tag, it finds ALL the information.

Quote
and what should i do, if i want to apply mp3gain to my files, and play them throug fb2k (but not use fb2k gain calculus)?

In Foobar preferences, Playback tab, Replaygain box, select "disabled".  Foobar will ignore the Replaygain information, but your MP3 will still play at the correct level because MP3Gain has adjusted the gain headers of all the individual blocks of music (which Foobar cannot ignore).
Title: Difference between Mp3gain and Replaygain
Post by: kwanbis on 2004-09-07 17:17:22
Quote
Quote
"Options" > "Tags" > "Recalculate (do not read tags)"

would make mp3gain recalculate the global tag, after computing the frame ones, which we would like

That's right.

Quote
and what should i do, if i want to apply mp3gain to my files, and play them throug fb2k (but not use fb2k gain calculus)?

In Foobar preferences, Playback tab, Replaygain box, select "disabled".  Foobar will ignore the Replaygain information, but your MP3 will still play at the correct level because MP3Gain has adjusted the gain headers of all the individual blocks of music (which Foobar cannot ignore).
[a href="index.php?act=findpost&pid=240028"][{POST_SNAPBACK}][/a]


so, it i run replaygain, with "Options" > "Tags" > "Recalculate (do not read tags)" checked, it would clean the fb2k calculations ... so i don't need to disable the replaygain box in foobar ...

Quote
Quote
"Options" > "Tags" > "Recalculate (do not read tags)"

would make mp3gain recalculate the global tag, after computing the frame ones, which we would like

That's right.

Quote
i allways used MP3gain, and have no problem with foobar reading my tags ... so i don't get this also.

Great!  There's a couple of reasons why this might happen (a) because you have MP3Gain set to "Ignore (do not read or write tags)" or (b) because your MP3 Artist/Album/Track etc information is stored in APE tags, not ID3 tags.  So when Foobar finds the APE tag, it finds ALL the information.


i don't use APE tags ... and i don't have MP3Gain set to Ignore (do not read or write tags) either ... :|
Title: Difference between Mp3gain and Replaygain
Post by: litmitil on 2004-09-07 18:41:16
I struggled with this issue when I first started using mp3gain with Foobar too.
Now I make sure that my mp3s have proper APE tags BEFORE I mp3gain them. There are two ways that I do this:
1) For mp3s that have info in ID3 tags, I use a tag editor to make sure the info is correct, load them into Foobar and have Foobar rewrite the tags as APE tags, which it will do by default when you right-click and select "rewrite tags from database" (the type of tags Foobar writes when it performs that action are set in the standard inputs section of the preferences). Then I mp3gain normally.
2) For ripping new CDs, I use EAC with wapet.exe (http://www.saunalahti.fi/~cse/files/wapet.zip) with the command line at http://www.hydrogenaudio.org/forums/index....t=ST&f=15&t=203 (http://www.hydrogenaudio.org/forums/index.php?act=ST&f=15&t=203) to write the APE tags at the time of encoding. Then I mp3gain normally and all is right with the world.
Title: Difference between Mp3gain and Replaygain
Post by: Pootle_1 on 2004-09-10 14:10:58
Quote
so, it i run replaygain, with "Options" > "Tags" > "Recalculate (do not read tags)" checked, it would clean the fb2k calculations ... so i don't need to disable the replaygain box in foobar ...
Ermmmm... it's not that simple. Trouble is, Foobar will write it's Replaygain information to the tag type you have set up in Preferences > Playback > Input > Standard inputs.  If you have that set to "ID3v2 and ID3v1" then that's the tags it will use.

If you then MP3Gain the file, it will write ReplayGain values to an APE2 tag.  Your file will now have two lots of ReplayGain info in two different tags.

Fortunately, Foobar will see the APE2 tag written by MP3Gain and ignore everything else, including the ID3 tags which it earlier wrote itself.  So MP3Gain will effectively have hidden the tags which Foobar wrote, even though they are still there.

If you set Foobar's Preferences > Playback > Input > Standard inputs to "APE2 and ID3v1" then everything WILL happen as you suggest - then Foobar will write it's ReplayGain va;ues to an APE tag and MP3Gain will "clean" it.

Hope this helps!
Title: Difference between Mp3gain and Replaygain
Post by: ToS_Maverick on 2004-09-10 14:51:51
another solution would be if MP3Gain would read/support ID3v2 tags in which foobar has written the replaygain values.

this would be acceptable for me because i have an CD-MP3 player in my car which supports ID3v2 and i want to use MP3Gain with it.
Title: Difference between Mp3gain and Replaygain
Post by: singaiya on 2005-07-31 17:17:50
Just wanted to note that the tag issues I referenced in my post seem to be resolved using the new foobar2000 0.9beta, probably due to it's new ability to merge tag types. Hurrah!
Title: Difference between Mp3gain and Replaygain
Post by: Bill02888 on 2005-10-22 17:07:20
I'm just starting to use MP3Gain on my MP3 files. I noticed this behaviour. The "clipping may occur" warning has me a bit concerned. Why would it compute values that may cause clipping? Should I do something to make it so that clipping won't occur?

Edit: I added the /k switch but still get the warning when I do

mp3gain.exe *.mp3 >mp3gain.log
mp3gain.exe /a /c /k *.mp3

Quote
01 There Is No Fourth Tower.mp3
Recommended "Track" dB change: 7.040000
Recommended "Track" mp3 gain change: 5
Max PCM sample at current gain: 13291.338871
Max mp3 global gain field: 255
Min mp3 global gain field: 141

02 Two Bear Feet.mp3
Recommended "Track" dB change: 9.020000
Recommended "Track" mp3 gain change: 6
Max PCM sample at current gain: 11568.669029
Max mp3 global gain field: 255
Min mp3 global gain field: 141

03 Bargaining With Borneo Cannibals.mp3
Recommended "Track" dB change: 8.860000
Recommended "Track" mp3 gain change: 6
WARNING: some clipping may occur with this gain change!
Max PCM sample at current gain: 14026.897870
Max mp3 global gain field: 235
Min mp3 global gain field: 141

04 The Price Is Your Heart!.mp3
Recommended "Track" dB change: 7.780000
Recommended "Track" mp3 gain change: 5
WARNING: some clipping may occur with this gain change!
Max PCM sample at current gain: 14106.647114
Max mp3 global gain field: 255
Min mp3 global gain field: 141

Recommended "Album" dB change for all files: 7.900000
Recommended "Album" mp3 gain change for all files: 5
WARNING: with this global gain change, some clipping may occur in file 03 Bargaining With Borneo Cannibals.mp3
WARNING: with this global gain change, some clipping may occur in file 04 The Price Is Your Heart!.mp3
Title: Difference between Mp3gain and Replaygain
Post by: Bill02888 on 2005-10-23 05:14:23
I was being stupid. The log doesn't know that I later specify the /k option. Worked like a champ. Feel like a chump! 
Title: Difference between Mp3gain and Replaygain
Post by: Eric S on 2007-01-30 01:54:39
this entire thread has been VERY interesting.

Isn't the easiest thing to just use MP3Gain to adjust the gain values in the files and not worry about the ReplayGain tags?  Then the files should play properly on any MP3 device.

is there some downside to doing this versus using ReplayGain tags?
Title: Difference between Mp3gain and Replaygain
Post by: Firon on 2007-01-30 04:19:26
The files are modified? That's about it, really... I guess if you drive it to clipping, then it doesn't have a peak tag for an RG-supporting player to scale down with.
Title: Difference between Mp3gain and Replaygain
Post by: pepoluan on 2007-01-30 05:45:18
With MP3Gain you must choose between Track RG and Album RG. With RG metadata you can have both.

But truthfully if your CD is not mastered to be seamless between tracks, you can just ignore Album RG.
Title: Difference between Mp3gain and Replaygain
Post by: Eric S on 2007-01-30 14:20:42
The files are modified? That's about it, really... I guess if you drive it to clipping, then it doesn't have a peak tag for an RG-supporting player to scale down with.



How does the peak tag work?
Title: Difference between Mp3gain and Replaygain
Post by: Hollunder on 2007-01-30 23:52:07
Is there some sort of standard in the meantime?
I'd find it great if RG values would be stored in APEv2 and/or id3 as metadata only by more or less every programm and for any format that can handle those.
For formats that can't handle metadata I can imagine the player of choice's media library handling the RG values for those files.

I'm just curious if there is that kind of consensus because it would make it easier for new players to handle RG values properly.
II may try to convince the Aqualung developers to use RG instead of their own RVA-System (http://aqualung.sourceforge.net/manual.html#SECTION00042700000000000000) which seems to be very similar to replaygain but is, as far as I know, uniquely supported by aqualung.
Convincing them might be difficult if every program handles and tags RG in a different way.

Maybe someone with more insight can comment on this.
Title: Difference between Mp3gain and Replaygain
Post by: Eric S on 2007-02-25 19:36:17

"MP3Gain determines the Replaygain values for the MP3 file. MP3Gain then writes to the global gain header of every block, adjusting them all up or down by the same amount in order to achieve those Replaygain "



I have read conflicting things about how to operate the MP3Gain GUI and what it does.  If i only want to write to the global gain header of an MP3file (and not worry about writing the ReplayGain tags),  what actions do i take in the GUI?

I've read that hitting the "track analysis" button will modify the "volume bits" (i assume that is the global gain header) but in my experience i have to hit the "Gain" button to actually alter the volume of the files.

I'd like to modify the volume of my MP3s so they play consistently in my iPod as well as my Squeezebox.  the iPod, of course, does not recognize ReplayGain tags, but my Squeezebox does.  If i understand correctly, i can modify the global gain header and it will work the same way in both my iPod and my Squeezebox (i would NOT use the Volume Adjustment option in my Squeezebox).

Can anyone help me with this?
Title: Difference between Mp3gain and Replaygain
Post by: Martin H on 2007-02-27 12:34:49
Maybe someone with more insight can comment on this.

The de-facto RG tag fields are :

replaygain_track_gain
replaygain_track_peak
replaygain_album_gain
replaygain_album_peak

They where originally proposed by Garf for making an RG standard for Vorbis and where then implemented in VorbisGain and since then everyone has followed.

For MP3, then mp3gain.exe sets the four above tags + between 1 and 3 others depending on the situation as APEv2 tags, but as APEv2 tags on MP3's never really has catched up, then fb2k and Winamp sets the four above tags as ID3v2 TXXX frames and in which i believe will sooner or later become the de-facto standard for MP3 RG tags(if it isn't allready).
If i only want to write to the global gain header of an MP3file (and not worry about writing the ReplayGain tags),  what actions do i take in the GUI?

Disable tagging and then apply track/album gain
Quote
I've read that hitting the "track analysis" button will modify the "volume bits" (i assume that is the global gain header) but in my experience i have to hit the "Gain" button to actually alter the volume of the files.

When analyzing in MP3Gain, then mp3gain.exe will RG scan the files and set APEv2 RG tags on them, but the global gain fields in the headers of each MP3 frame aren't touched. This is the same if you just run "mp3gain *.mp3".
Quote
I'd like to modify the volume of my MP3s so they play consistently in my iPod as well as my Squeezebox.

Load the MP3's into MP3Gain and apply track or album gain.
Title: Difference between Mp3gain and Replaygain
Post by: Eric S on 2007-02-27 23:21:58
Thanks!

One thing confuses me:  if sounds like if i do an "analysis" with MP3Gain that it will write RG tags to the files -- if that's correct, why don't the files show an new "date modified" value in Windows Explorer?  if MP3Gain is writing these tags to the files, doesn't that modify the files?

And when does it actually write the tags?  if you load a bunch of files in and do an analysis, it will tell you how the files differ from the target volume value.  But if you change the target volume value, it immediately updates the difference amount for all the files -- but too quickly to actually be writing to the files.  Is "analysis" really writing anything to the files?
Title: Difference between Mp3gain and Replaygain
Post by: Martin H on 2007-02-28 15:31:43
if sounds like if i do an "analysis" with MP3Gain that it will write RG tags to the files

Correct.
Quote
if that's correct, why don't the files show an new "date modified" value in Windows Explorer?

Press F5 to update Windows Explorer. If still not showing, then check if you have disabled tagging. If tagging isn't disabled, then whenever you reload some MP3's that you have analyzed before, then the RG info will be displayed immidiately, without the need to rescan the MP3's again.
Quote
And when does it actually write the tags?

Right after the analysis is finished.
Quote
if you load a bunch of files in and do an analysis, it will tell you how the files differ from the target volume value.  But if you change the target volume value, it immediately updates the difference amount for all the files -- but too quickly to actually be writing to the files.  Is "analysis" really writing anything to the files?
Yes, "Analysis" is really writing to the files, but the RG tags that's set during analyzing are relative to the de-facto reference loudness i.e. 89dB(the RG spec. is actually 83dB, but that is outdated and never used anymore). If you then apply an e.g. value of 92dB right after you have analyzed the MP3's, then the RG tags is altered to reflect the new change in loudness.
Title: Difference between Mp3gain and Replaygain
Post by: Northpack on 2008-02-12 12:51:37
Hello,

after diving through all of these topics concerning the usage of mp3gain and, respectively, foobar's replaygain, I still got stuck with the following problem, as before mentioned in these topics:

http://www.hydrogenaudio.org/forums/index....showtopic=52283 (http://www.hydrogenaudio.org/forums/index.php?showtopic=52283)
http://www.hydrogenaudio.org/forums/index....showtopic=57038 (http://www.hydrogenaudio.org/forums/index.php?showtopic=57038)

(I'll post it here anyway because this seems to be to most comprehensive one)

In spite of that I prefer the simplicity of replaygain's concept - to write a single header which enables the decoder to do track- as well as album-gain on the fly - I really appreciate the functionality of mp3gain, simply because my hardware player doesn't support that replaygain header (as it is the fate of many great concepts which don't get the appropriate promotion...). My problem is, though: when i make any change to the ID3 tag with foobar later, the tag holding the origininal gain values which mp3gain wrote to the file in order to make the gain change reversible, gets lost (I don't know which kind of tag holds this information, though it can't be identical with the replaygain tag).

On the other hand, if I do the same thing mp3gain does with foobar ("apply track/album replaygain to mp3 data"), it seems that foobar won't store any such information of the origininal gain and thus it becomes irreversible (the function "remove replaygain info from files" just strips the ordinary replaygain tag, not the gain information applied to the mp3 data)

Here's an example: if i track-gain a bunch of mp3s in order to play them shuffled on my hardware-player, it's important for me to keep the original gain value, so that the intended relative volume of each track remains intact, when I want to listen a whole album. Now that would be fine with mp3gain: I'd just have to "undo gain changes" later. But when foobar comes in - which is really essential as a player and tagger for me - the according information get lost. However, when I use foobar instead of mp3gain, such information won't be maintained at all. Now isn't that an absolutely unnecessary annoyance? It could easily be avoided, either if Foobar would simply maintain the tags written by mp3gain, or even better, write it's own tags containing undo-information (so one wouldn't need mp3gain at all).

Does maybe someone know any workaround on this problem? Is there a chance that the beforementioned functionality could be implemented in future foobar versions (it would make the best mp3 player out there even better)?

PS. Please excuse my mediocre English. I hope it's enough to be roughly understood, though.
Title: Difference between Mp3gain and Replaygain
Post by: pdq on 2008-02-12 14:19:50
PS. Please excuse my mediocre English. I hope it's enough to be roughly understood, though.

If you had not said anything then I never would have guessed that English wasn't your native language, so stop apologising.
Title: Difference between Mp3gain and Replaygain
Post by: Lyx on 2008-02-12 15:46:25
Here is a - from my understanding - safe procedure to have BOTH, mp3gain-style block-modification and foobar-style RG-tagging:

- use mp3gain or foobar to apply ALBUMGAIN to the individual frames. Leave the target-value at the de-facto standard 89db. Do not bother adding undo-information.

- then scan the mp3 with foobars replaygain and add RG-tagfields for albumgain and trackgain.


Why? Well, the situation afterwards will be the following:
- non-replaygain aware players will correctly play your files in albumgain mode
- the relative differences in loudness between tracks, as well as seamless trackchanges, will be kept intact, because albumgain was used. Because of this, you can also use any tag-based RG-scanner like foobars, to analyze the files, without strange things happening
- RG-tagfield aware players will be able to make use of albumgain or trackgain, so you get the full functionality of tag-based replaygain

The deciding choice in this scheme is to irreversibly albumgain the mp3-file without bothering to add undo-information. Because of this, all the mentioned conflicts and issues become irrelevant. But since albumgain was used, there isn't really any need to undo the changes, because relative differences in loudness between tracks will be kept intact.

The only downside i can think of is of purely informative nature: The tagbased albumgain-value will always be near zero (because the file was already albumgained by mp3gain). So, if it is important to you to afterwards see the "true" albumgain value of an album, then you may dislike this scheme. Notice that this does not really hurt normal usage in practice - it just means that you have one less "nice number" to look at.
Title: Difference between Mp3gain and Replaygain
Post by: Northpack on 2008-02-12 17:25:43
If you had not said anything then I never would have guessed that English wasn't your native language, so stop apologising.
Sorry 

Here is a - from my understanding - safe procedure to have BOTH, mp3gain-style block-modification and foobar-style RG-tagging:

- use mp3gain or foobar to apply ALBUMGAIN to the individual frames. Leave the target-value at the de-facto standard 89db. Do not bother adding undo-information.

- then scan the mp3 with foobars replaygain and add RG-tagfields for albumgain and trackgain.

[...]
Thanks for your reply. I agree with you that the loss of original gain-values isn't that serious when album-gain is applied instead of track based gain, since the relative volume levels remain, but the underlying problem for me is the irreversible change to the mp3-data. I'm just bothered because there actually is a simple and adequate method to safe this undo-information - but replaygain somehow manages to discard it. So why should I irreversebly alter my whole mp3 collection just because foobar is oddly at odds with mp3gain!?
Title: Difference between Mp3gain and Replaygain
Post by: Bourne on 2008-02-12 17:48:48
I have one stupid question....

Turning an MP3 gain down to -8.0dB and then playing it on a stereo with volume much louder than the original gain it had (playing at let's say +8.0dB) will it have the exact sound/feeling/bass/treble/stuff that the original gain?

I ask this because I have read "replaygain" is not perfect. So just making sure...
Title: Difference between Mp3gain and Replaygain
Post by: 2Bdecided on 2008-02-12 18:20:43
7.5dB or 9dB - mp3gain only works in multiples of 1.5dB.

With 24 bit decoding from a 16 bit source - identical, except any decoder related clipping will be removed.

With 16 bit decoding from a 16 bit source - identical, except any decoder related clipping will be removed, and any information in the last 1 or 2 bits will be rounded away or dithered depending on the decoder (i.e. effectively noise is introduced at -96dB in the final 16-bit decode).

Cheers,
David.
Title: Difference between Mp3gain and Replaygain
Post by: Northpack on 2008-02-12 18:26:54
I have one stupid question....

Turning an MP3 gain down to -8.0dB and then playing it on a stereo with volume much louder than the original gain it had (playing at let's say +8.0dB) will it have the exact sound/feeling/bass/treble/stuff that the original gain?

I ask this because I have read "replaygain" is not perfect. So just making sure...


There will be no difference in the overall sound of the track because all frequencies are affected by the same amount of gain change (no equalizing is done). Howewer, if there's a very quiet sound in a certain frequency area, which was hardly audible even on original gain, it may sink under the noise-floor of your playback equipment when lowering the gain. But i guess this is rather a theoretical concern because most music produced today is heavily dnr-compressed, so that there shouldn't be much of a risk this could actually produce audible consequences...
Title: Difference between Mp3gain and Replaygain
Post by: Bourne on 2008-02-12 18:35:22
David...

So, consider two WAV files, one processed and one original.
One of them I WAVEGAIN it down to -12.00 and the original I leave alone.
If I play the one that has been processed with a higher volume (+12.00 from that starting point) will be equally loud identical to the original file?

I know MP3Gain does it by 1.5 steps, but foobar2000 does not calculate with that limitation, unless it's not saying it properly....

Quote
There will be no difference in the overall sound of the track because all frequencies are affected by the same amount of gain change (no equalizing is done). Howewer, if there's a very quiet sound in a certain frequency area, which was hardly audible even on original gain, it may sink under the noise-floor of your playback equipment when lowering the gain. But i guess this is rather a theoretical concern because most music produced today is heavily dnr-compressed, so that there shouldn't be much of a risk this could actually produce audible consequences...


Hmm... I sometimes DO NOTICE some kind of ANNOYANCE when I replaygain very clip-pressed albums and play them "as the old good CD back in the 80's". It just doesn't sound the same, and the sound gets really flat. I mean, they sound better loud & left alone.. could it be what you're saying?
Title: Difference between Mp3gain and Replaygain
Post by: Northpack on 2008-02-12 18:45:49
7.5dB or 9dB - mp3gain only works in multiples of 1.5dB.

With 24 bit decoding from a 16 bit source - identical, except any decoder related clipping will be removed.

With 16 bit decoding from a 16 bit source - identical, except any decoder related clipping will be removed, and any information in the last 1 or 2 bits will be rounded away or dithered depending on the decoder (i.e. effectively noise is introduced at -96dB in the final 16-bit decode).
Clipped and precise, and faster than me
But now as this topic is hounoured by your presence... could you maybe comment on the mp3gain stuff? 

Hmm... I sometimes DO NOTICE some kind of ANNOYANCE when I replaygain very clip-pressed albums and play them "as the old good CD back in the 80's". It just doesn't sound the same, and the sound gets really flat.
I know what you mean. But that's due to the inferior production standarts today... which are revealed when the stuff is played back on a reasonable gain level and compared with a sound production of good ol' times...
Title: Difference between Mp3gain and Replaygain
Post by: Bourne on 2008-02-12 18:49:17
I just never knew what that was... you put it right... "if there's a very quiet sound in a certain frequency area, which was hardly audible even on original gain, it may sink under the noise-floor of your playback equipment when lowering the gain."

I actually find this very annoying and end up not applying the ReplayGain on the songs for the stereo playback. (on the PC with headphones is fine).
Title: Difference between Mp3gain and Replaygain
Post by: Lyx on 2008-02-12 19:17:21
I just never knew what that was... you put it right... "if there's a very quiet sound in a certain frequency area, which was hardly audible even on original gain, it may sink under the noise-floor of your playback equipment when lowering the gain."

I actually find this very annoying and end up not applying the ReplayGain on the songs for the stereo playback. (on the PC with headphones is fine).

For this to happen in practice, you need uncompressed classical music and a playback-level which is at an ear-damaging 100 dB..... but then again, at such large dynamic range, the ATH-model of the mp3-encoder may be a much more serious issue.

...either that, or you need a highly defective equipment-part in your playback chain.... something which has an insanely high noisefloor. I do not just mean bad equipment - i really mean defective.

However, in spite of the above, there is another explanation with a much higher degree of probability: Placebo.
Title: Difference between Mp3gain and Replaygain
Post by: Bourne on 2008-02-12 19:57:04
oh yes it's placebo and the dogma of the enigma is outbursting into a ship clouded by noise shaping skull nonbrain case of /mnt but you're not root then you can't do it.
Title: Difference between Mp3gain and Replaygain
Post by: Northpack on 2008-02-12 20:02:18
oh yes it's placebo and the dogma of the enigma is outbursting into a ship clouded by noise shaping skull nonbrain case of /mnt but you're not root then you can't do it.
Uhm... sounds like the lyrics of a Current 93 song
Title: Difference between Mp3gain and Replaygain
Post by: Northpack on 2008-02-13 11:18:57
When I read out the APEv2 tags written by Mp3gain with Mp3tag, it correctly displays the following fields:

Code: [Select]
MP3GAIN_ALBUM_MINMAX = 067,208
MP3GAIN_MINMAX = 121,178
MP3GAIN_UNDO  = +002,+002,N
REPLAYGAIN_ALBUM_GAIN = -1.830000 dB
REPLAYGAIN_ALBUM_PEAK = 0.929289
REPLAYGAIN_TRACK_GAIN = -0.610000 dB
REPLAYGAIN_TRACK_PEAK = 0.694031


After doing any change to the tags with foobar, the MP3GAIN_* fields are vanished. I even tried to outsmart foobar by some script like <copy "MP3_GAIN_UNDO" to "MP3_GAIN_UNDO">, but it's futile. foobar just doesn't recognize the tags written by mp3gain. The REPLAYGAIN_* fields are all recalculated after a tag change - so foobar doesn't seem to recognize them either. I also tried to check "compatibility mode" in Preferences/Advanced/Tagging, but without any success.

So what's about these APE tags written by Mp3gain that Mp3tag reads them correctly but foobar doesn't handle them at all?
Title: Difference between Mp3gain and Replaygain
Post by: Lyx on 2008-02-13 16:18:13
To understand this behaviour, a bit of background information is necessary. You need to be aware of the following:

1. Foobar2000 is NOT designed around the idea of the user manually managing tag-types. It is especially not designed for having different kinds of metadata in different tag-types simultaneusly. The approach which foobar uses is to "abstract" metadata: The user only enters the desired metadata, and foobar automatically cares about how to store it. This way, metadata-manipulation across different filetypes works identical on the user-side and therefore is compatible with each other. No matter if you manipulate metadata about an MP3, or metadata about a FLAC, it is always the same procedure and interface. This however can only work, if there is "metadata integrity" - meaning that all metadata of a given filetype is stored the same way and there are not multiple tags in a single file with conflicting metadata. In short: this approach is only feasible when all files and metadata are "in sync". It does not matter if you agree with this approach or not - it just matters that foobar is designed around this approach... therefore, if you cannot live with it, then foobar is the wrong tool for your needs.

2. Foobar currently does not do any merging of metadata when reading files. In the case of mp3, it only reads from the selected (advanced preferences) tag-type and ignores the rest. As for "why?" - well, i dont know the full story, so a dev-reply would be needed for the full picture. What i know however is, that in the past there was no robust idea on how to merge multiple tagtypes when reading - what i mean is the "ruleset when merging". Part of the problem is that when the same metadata field exists in multiple tagtypes (dupe-info), then how should a machine decide which one is preferable? A machine does not understand what metadata like TRACKTITLE says... its just a bunch of random letters to it.

3. For MP3, foobar supports the following tagging schemes: ID3v2, ID3v1 + ID3v2, APE, ID3v1 + APE. Why is there no APE + ID3v2? Well, because ideally, there is absolutely no point to it. APE is a "replacement" for ID3v2, not an addition. The point of using APE tags is getting rid of ID3v2 and its conflicting standards. If you use ID3v2, then there is no point in APE. HOWEVER, for whatever strange reasons, mp3gain uses exactly this weird and senseless combination of tagtypes. The mess starts here.... continue reading....

4. When foobar changes metadata, then it works the following way: First read metadata according to the above rules. Save it in RAM temporarily. Then modify this read metadata according to the user. Then REPLACE the metadata in the file, with this modified metadata.... therefore dropping all unsupported metadata. Why? Well, read "1." again... the whole point of foobars metadata management is that the metadata in files is in sync without the user having to care about it.

From my POV, what we have here is the combination of two design-flaws..... a flaw in mp3gain, and a flaw in foobar. Just one of the flaws is sufficient, to render the current undo-information of mp3gain useless. The flaw on foobar2000's side is that it has not even the slightest capability of merging tagtypes when READING. What FB2k IMO should do in the current scenario, is reading the APE-metadata of mp3gain, and then delete the APE tag and save the undo-information in ID3v2, therefore not causing any dataloss, but making the undo-data incompatible with mp3gain.

The flaw in mp3gain is using a stupid combination of tagtypes. It should write its undo-information in the already existing tagtype instead - so, usually as ID3v2.
Title: Difference between Mp3gain and Replaygain
Post by: Bourne on 2008-02-13 17:49:38
If you run MP3Gain through your files, they will get tagged with APEv2 tags. If you open these same files in FB2k and update *a single field of any kind*  in the tags, the undo information will be gone. The only workaround for this is to set FB2K to manipulate APEv2 tags only, like creating MP3 files only with APEv2 tags and removing any kind of ID3Vx tags. After you know your tags are ALL and ONLY APEv2, then you can change the files in MP3Gain and update tags in FB2K, and the UNDO information will be preserved.
Title: Difference between Mp3gain and Replaygain
Post by: Lyx on 2008-02-13 17:59:47
If you run MP3Gain through your files, they will get tagged with APEv2 tags. If you open these same files in FB2k and update *a single field of any kind*  in the tags, the undo information will be gone. The only workaround for this is to set FB2K to manipulate APEv2 tags only, like creating MP3 files only with APEv2 tags and removing any kind of ID3Vx tags. After you know your tags are ALL and ONLY APEv2, then you can change the files in MP3Gain and update tags in FB2K, and the UNDO information will be preserved.

Except of that non APE-aware players will:

- display absolutely nothing
- display truncated info if you also write to ID3v1
Title: Difference between Mp3gain and Replaygain
Post by: Northpack on 2008-02-13 18:09:19
Lxy: thanks for this very comprohensive response. I guess I'm much wiser now 

From my POV, what we have here is the combination of two design-flaws..... a flaw in mp3gain, and a flaw in foobar. Just one of the flaws is sufficient, to render the current undo-information of mp3gain useless. The flaw on foobar2000's side is that it has not even the slightest capability of merging tagtypes when READING. What FB2k IMO should do in the current scenario, is reading the APE-metadata of mp3gain, and then delete the APE tag and save the undo-information in ID3v2, therefore not causing any dataloss, but making the undo-data incompatible with mp3gain.

The flaw in mp3gain is using a stupid combination of tagtypes. It should write its undo-information in the already existing tagtype instead - so, usually as ID3v2.
I understand the design concept you explained in (1) and it seems reasonable to me. I also appreciate the approach of establishing a proper order out of the confusion of various tag formats. It's just a pitty that on the one hand mp3gain doesn't care about such a philosophy and foobar on the other hand doesn't offer any possibility, to keep these undo-information in a tidied-up form. The best possible solution however, would be achieved if foobar introduced it's own funtionality to undo gain changes - and convert the tag-mess created by mp3gain accordingly (I hope Peter reads this ).
Title: Difference between Mp3gain and Replaygain
Post by: Lyx on 2008-02-13 19:05:50
I understand the design concept you explained in (1) and it seems reasonable to me. I also appreciate the approach of establishing a proper order out of the confusion of various tag formats. It's just a pitty that on the one hand mp3gain doesn't care about such a philosophy and foobar on the other hand doesn't offer any possibility, to keep these undo-information in a tidied-up form. The best possible solution however, would be achieved if foobar introduced it's own funtionality to undo gain changes - and convert the tag-mess created by mp3gain accordingly (I hope Peter reads this :rolleyes:).

Perhaps that would be the most efficient approach, yes. Store "frame-gain" undo-information in the same format as mp3gain, but instead use either APE or ID3v2, depending on which tag-type is the primary one of the file. Then read mp3gain stuff and transfer the metadata accordingly.

It's perhaps interesting to know how this weird situation came into being at all. At the early days of foobar and mp3gain, APE-tags in mp3s were something really exotic. It was something which theoretically is possible, but which typically isn't implemented in apps.

Then two things happened:
1. Foobar was the first player to really push APE in MP3, by even defaulting to it. Because of the standards-mess which ID3v2 is, it tried to push APE as a replacement - a clean start - from ID3v2. APE basically can do whatever ID3v2 can, but does it cleaner, simplier and more reliable. The approach failed, because the inertia of ID3v2 was just too big. So foobar transitioned into a new strategy by defaulting to ID3v2, but adhering as much as reasonable to to the standard (for example by using unicode only, instead of anonymous system codepages).

2. MP3gain appeared. I can only guess as to its motives for storing undo information in an APE-tag, but i would suspect that the idea was "safety by obfuscation". As already mentioned, at the time nearly every player was unaware of APE. This means that other players would be completely blind to the APE-tag and just ignore it. So perhaps the idea was, to "hide" the undo-information from other apps, by using an unknown tag-type (APE).

The results of the above are visible now.
Title: Difference between Mp3gain and Replaygain
Post by: Northpack on 2008-02-13 21:49:25
Lyx: ....still growing wiser ...

I wonder what this foobar option Force prefered tag writing scheme on all files regardless of existing tags is supposed to do, if not exactly what it suggests - but then our our problem should become solved by unchecking it. Which isn't so (another hope has vanished  )
Title: Difference between Mp3gain and Replaygain
Post by: Lyx on 2008-02-13 22:53:14
Lyx: ....still growing wiser ;)...

I wonder what this foobar option Force prefered tag writing scheme on all files regardless of existing tags is supposed to do, if not exactly what it suggests - but then our our problem should become solved by unchecking it. Which isn't so (another hope has vanished :cry: )

Normally, foobar respects the tags already existing in a file IF (and only if).... it is "id3v2", "id3v1 + id3v2", "ape", "ape + id3v1". Thus, "which tags to use" is a "per file choice". One can manually switch the scheme, by adding the coresponding command to the contextmenu (i think its not there by default).

The setting in the advanced preferences which you talk about is an "override" for the above. It means that foobar should automatically "convert" the tagging scheme of every mp3 it writes to, to the default scheme set in the advanced preferences. So, by enabling that checkbox you switch from "per-file tagscheme" to "global tagscheme".

Since "ID3v2 + APE" is not part of the available schemes, it does not solve your conflict.

EDIT: Possibly there is another solution which could be implemented on foobar's side, which would do away with such conflicts alltogether.... but i dont know enough technical details to know if there are problems with it.

1. Allow to read from any combination of ID3v1, ID3v2 and APE. Read the tags in the order "APE > ID3v2 > ID3v1". Merge the results. If any metadatafield exists in more than one of the available tags, then just give priority to the higher order tag-type. Discard anything else.

2. Allow writing to ID3v2 and APE simultaneusly, regardless of it being pointless from an idealistic POV. However, always sync all tags which are written to, when writing. Thus, if a file had mixed metadata in ID3v1, ID3v2 and APE, then the resulting written file will have the same metadata written to all tagtypes (taking into account tagtype limits, i.e. with ID3v1). Thus, in the mp3gain-scenario, the stuff written in ID3v2 would be mirrored to APE, and the undo-data in the APE-tag would be mirrored to ID3v2.

- Lyx
Title: Difference between Mp3gain and Replaygain
Post by: Bourne on 2008-02-13 22:56:32
Quote
Except of that non APE-aware players will:

- display absolutely nothing
- display truncated info if you also write to ID3v1



exactly... i have seen car stereos that only read ID3Vx and the MP3 tags are substituted by default wildcards TrackX, ArtistX... I don't know any hardware player APEv2 aware!
Title: Difference between Mp3gain and Replaygain
Post by: Northpack on 2008-02-14 01:02:46
EDIT: Possibly there is another solution which could be implemented on foobar's side, which would do away with such conflicts alltogether.... but i dont know enough technical details to know if there are problems with it.

1. Allow to read from any combination of ID3v1, ID3v2 and APE. Read the tags in the order "APE > ID3v2 > ID3v1". Merge the results. If any metadatafield exists in more than one of the available tags, then just give priority to the higher order tag-type. Discard anything else.

2. Allow writing to ID3v2 and APE simultaneusly, regardless of it being pointless from an idealistic POV. However, always sync all tags which are written to, when writing. Thus, if a file had mixed metadata in ID3v1, ID3v2 and APE, then the resulting written file will have the same metadata written to all tagtypes (taking into account tagtype limits, i.e. with ID3v1). Thus, in the mp3gain-scenario, the stuff written in ID3v2 would be mirrored to APE, and the undo-data in the APE-tag would be mirrored to ID3v2.

I think you've got it. That would be a less principled but imho much more practiable and yet logical consisent approach (as for merging, the tag priority order would also apply: e.g. if there is a tag specified both in APE
only or both in APE and ID3v2, the APE tag will be synced to IDv2 [truncation will be applied if nessesary]; if there is a tag specified in ID3v2 only, it will be synced to to APE).
Strangely enough, that there actually seems to be not a single program capable of merging different tag types in the described manner - or anyhow.... Mp3Tag uses a priority APE > ID3v2 > ID3v1 when reading out tag information but isn't capable of merging at all. Could it be that hard to implement?

Meanwile I figured out a dirty little hack for our problem. So throw away all of yor ideals and go through the following procedure ,

You need Mp3tag in order to do this.The only downside on this solution is that you have to dispense ID3v2 tags. There is another, real dirty option if you can't go without them: simply disable "force prefered track writing scheme" in step (7) - but be very aware of the consequences - foobar now writes MP3Gain and Replaygain Information into the ID3v2 tag and keeps them also in APE tag (why now and not before? Edit: Because they are now copied from ID3v2 to APE). So if you later change the Gain using MP3Gain, only the APE values will be affected whether the ID3v2 tag remains untouched and now contains wrong values. To update these, you'd have to go through the whole procedure again...

Edit:
If you run MP3Gain through your files, they will get tagged with APEv2 tags. If you open these same files in FB2k and update *a single field of any kind*  in the tags, the undo information will be gone. The only workaround for this is to set FB2K to manipulate APEv2 tags only, like creating MP3 files only with APEv2 tags and removing any kind of ID3Vx tags. After you know your tags are ALL and ONLY APEv2, then you can change the files in MP3Gain and update tags in FB2K, and the UNDO information will be preserved.
I developed the method above because this suggestion didn't work. When stripping the ID3 tags, foobar still discards the original APE and overwrites it with the former ID3v2 content. But it indeed makes your life easier if you haven't mp3gained your files yet. Just do as in step (7), rewrite tags on all of your files (check it with Mp3tag, they should have only ID3v1 and APE now) and subsequently, apply mp3gain.
Title: Difference between Mp3gain and Replaygain
Post by: Lyx on 2008-02-14 01:52:59
I think you've got it.

Nope, i dont. There is a severe logical flaw in my idea:

If APE always gets priority over ID3v2.... and both, ID3v2 and APE are in a file, with both being in sync.... then this means that changes to ID3v2 metadata made by any other tagging app, will later be overwritten by foobar, since APE is still there and gets priority.
Title: Difference between Mp3gain and Replaygain
Post by: Northpack on 2008-02-14 09:32:29

I think you've got it.

Nope, i dont. There is a severe logical flaw in my idea:

If APE always gets priority over ID3v2.... and both, ID3v2 and APE are in a file, with both being in sync.... then this means that changes to ID3v2 metadata made by any other tagging app, will later be overwritten by foobar, since APE is still there and gets priority.
But its't that the case with foobars current behavior - when it's se to APE and "force prefered track writing scheme" disabled?
It wouldn't be a logical flow if properly explained: only the highest priority tag contains the actual file information, all the others are written for backwards-compatibility only. If I only use foobar and mp3gain to touch my files, everything will be fine. And if my hardware player isn't capable of reading APE tags (is there actually anyone that is?), there are id3v2 with the same information.
Title: Difference between Mp3gain and Replaygain
Post by: Lyx on 2008-02-14 09:47:12
But its't that the case with foobars current behavior - when it's se to APE and "force prefered track writing scheme" disabled?
It wouldn't be a logical flow if properly explained: only the highest priority tag contains the actual file information, all the others are written for backwards-compatibility only. If I only use foobar and mp3gain to touch my files, everything will be fine. And if my hardware player isn't capable of reading APE tags (is there actually anyone that is?), there are id3v2 with the same information.

You're trying to obsolete ID3v2 again - it didn't work before and wont work now. My idea doesn't improve things in practice, but just make stuff worse.
Title: Difference between Mp3gain and Replaygain
Post by: Northpack on 2008-02-14 10:05:34
You're trying to obsolete ID3v2 again - it didn't work before and wont work now. My idea doesn't improve things in practice, but just make stuff worse.
I'm not trying to obsolete it but rather to keep it for backward compatiblity. It's imho exactly what foobar does for now (if set up like mentioned before) and your idea thus wouldn't worsen anything

Edit:
Normally, foobar respects the tags already existing in a file IF (and only if).... it is "id3v2", "id3v1 + id3v2", "ape", "ape + id3v1". Thus, "which tags to use" is a "per file choice". One can manually switch the scheme, by adding the coresponding command to the contextmenu (i think its not there by default).
Ok, after reading through this again I see now that actually it isn't the same. But I still think that another approach to handle a "ID3v2 + APE" situation, would do better: If foobar choses, in that particular situation, to eliminate any APE tags in order not to mess up with differing tag-values, it should a least read out the APE tag and merge any tag fields ony specified there and NOT in ID3v2 into the latter. At least, any unexpected loss of information would be avoided that way.
On the other hand: it wouldn't hurt so much to implement an option like "Leave tags not matching selected scheme intact" - and disable it by default. Would it?
Title: Difference between Mp3gain and Replaygain
Post by: tycho on 2008-02-14 10:49:17
FYI:
metamp3 does convert APE2 RG tags to ID3 tags (v2.3 ISO-8859-1 supported only) if they exist, and removes the APE2 RG tags. It also converts the undo-info to ID3 2.3 tags, so you may undo the applied RG by using metamp3. Additionally it can compute new RG tags stored as ID3 v2.3 tags, or apply them and create undo tags.

Make sure that any existing ID3 tags are v2.3 ISO-8859-1 before applying metamp3, otherwise it will corrupt your existing tags. I forgot to make a check for this.

Basically metamp3 does what mp3gain does, but stores tags as ID3 instead of APE2. Unfortunately the command line arguments are not compatible with mp3gain's, and some switches are missing. Maybe someday I'll do something with these issues.

http://www.hydrogenaudio.org/forums/index....&hl=metamp3 (http://www.hydrogenaudio.org/forums/index.php?showtopic=49751&hl=metamp3)

/edit:
I noted that undo info are written as a TXXX tag named "mp3gain_undo". I suppose "replaygain_undo" or "replaygain_undo_info" would be better. A de-facto standard should be established so that other application could utlilise this tag.
Title: Difference between Mp3gain and Replaygain
Post by: 2Bdecided on 2008-02-18 16:18:09
2. MP3gain appeared. I can only guess as to its motives for storing undo information in an APE-tag, but i would suspect that the idea was "safety by obfuscation". As already mentioned, at the time nearly every player was unaware of APE. This means that other players would be completely blind to the APE-tag and just ignore it. So perhaps the idea was, to "hide" the undo-information from other apps, by using an unknown tag-type (APE).
I'd have to ask Glen, but I think it was partly a simple "this is how you store this information" - nothing more, nothing less. mp3gain was the only application that supported the feature, and anything that came along later needed to copy the approach. foobar2k didn't because of it's attitude to tagging. I wonder if it wouldn't have been possible to allow foobar2k to put the ReplayGain info in APE2 tags, whatever tagging scheme was used for everything else?

I don't think Glen was ever keen to implement an ID3v2 tagger.

Cheers,
David.
Title: Difference between Mp3gain and Replaygain
Post by: Northpack on 2008-02-18 18:39:56
I wonder if it wouldn't have been possible to allow foobar2k to put the ReplayGain info in APE2 tags, whatever tagging scheme was used for everything else?

Actually it is! I'd recently updated to foobar 0.9.5.1 beta 2 and was very happily surprised that it now properly reads out and keeps all the tags written by mp3gain, regardless of tagging scheme - though this change isn't listed in the accordíng topic (http://www.hydrogenaudio.org/forums/index.php?showtopic=58351). Seems like Peter secretly fixed it for us

Update: When "force prefered tag writing scheme" is enabled, writing ID3v1+ID3v2 tags, foobar now exactly does what I suggested:
Quote
If foobar choses, in that particular situation, to eliminate any APE tags in order not to mess up with differing tag-values, it should a least read out the APE tag and merge any tag fields ony specified there and NOT in ID3v2 into the latter. At least, any unexpected loss of information would be avoided that way.

When you chose APE or ID3v1 + APE, former ID3v2 data is merged into the APE tag, so you'll still be able to undo changes with mp3gain.
With "force"-option disabled, ALL fields are written as ID3v2 as well as APE. Be aware that the priority is APE < ID3v2, so after undoing gain changes with mp3gain, foobar will override the updated values in APE with the previous ones, still present in id3v2!
The only way to avoid this, I guess, is to strip off any ID3v2 tags by forcing APE tag writing.

FYI:
metamp3 does convert APE2 RG tags to ID3 tags (v2.3 ISO-8859-1 supported only) if they exist, and removes the APE2 RG tags. It also converts the undo-info to ID3 2.3 tags, so you may undo the applied RG by using metamp3. Additionally it can compute new RG tags stored as ID3 v2.3 tags, or apply them and create undo tags.

That's a great alternative to mp3gain... did you ever thought about making a replaygain plugin out of it?
Title: Difference between Mp3gain and Replaygain
Post by: gism on 2010-07-26 20:05:43
I figured out a dirty little hack for our problem.

Dirty little hack works great.

Paste the following script in to the textfile that pops up:
Code: [Select]
$filename(Export.MP3Gain.txt,ANSI)$loop(%_path%)^|%_PATH%|%REPLAYGAIN_TRACK_GAIN%|%REPLAYGAIN_TRACK_PEAK%|%REPLAYGAIN_ALBUM_GAIN%|%REPLAYGAIN_ALBUM_PEAK%|%MP3GAIN_MINMAX%|%MP3GAIN_ALBUM_MINMAX%|%MP3GAIN_UNDO%|$
$loopend()

How can I modify this for the export file to display one line per track? In Masstagger now the option is adding "Input data (one line per track)".

13.If you've done everything right, you've got mp3s with neat APE tags containing all of the information from the former ID3v2 tags plus MP3Gain which will be kept for now on by foobar.

Can the files then be retagged (editing contents like year etc) with foobar without problems (with APE + ID3v1 writing scheme forced)?
Title: Difference between Mp3gain and Replaygain
Post by: Typhoon859 on 2012-08-01 13:40:10
MP3Gain doesn't detect RG information when it's stored in the ID3 tags so how are people recommending to do the scan in Foobar2000?  To do that you would have to add APE tags in Foobar to your files anyway.  MP3Gain can't apply any adjustments before doing its own analysis and storing that info in the APE regardless.  This is really just a problem of Foobar not having the ability to mix ID3 and APE or anything else really.  It's an issue here no matter what.
Title: Difference between Mp3gain and Replaygain
Post by: greynol on 2012-08-01 15:10:45
Did you read the entire discussion before you posted?

MP3Gain adjusts the actual data so that it can be played back at a normalized level in non-ReplayGain-aware players. foobar2000 is an RG-aware player. It also happens to have the ability to alter an mp3's global gain field but it isn't necessary for RG-adjusted playback.
Title: Difference between Mp3gain and Replaygain
Post by: Typhoon859 on 2012-08-01 21:53:46
Did you read the entire discussion before you posted?

MP3Gain adjusts the actual data so that it can be played back at a normalized level in non-ReplayGain-aware players. foobar2000 is an RG-aware player. It also happens to have the ability to alter an mp3's global gain field but it isn't necessary for RG-adjusted playback.

Yes, I did...  You seem to have a long history of misunderstanding me.  I actually have no idea why and don't know how to modify what I said to make it clearer. 

I was asking what was meant when the suggestion was made.  Without adding APE tags, scanning in Foobar by default adds to the ID3 tags, as was mentioned.  MP3Gain doesn't read RG information from ID3 tags and stores it's own undo values in APE so APE is necessary regardless.  Using MP3Gain would screw up how Foobar displays Album, Artist, and Track information regardless since it doesn't look at ID3 when it detects APE... 

I posted the thought to be explained differently or told some methodology that I may be overlooking.  Not sure what you even responded to but you sure seem adamant about saying that I didn't read the thread... 

Questions are good; comments are good.  This is a forum where inquiries such as these are meant to be explained by people who may know better.
Title: Difference between Mp3gain and Replaygain
Post by: greynol on 2012-08-01 22:11:11
Seeing this topic was abandoned two years ago and certainly isn't the only one on the subject, I recommend doing a bit more searching.
Title: Difference between Mp3gain and Replaygain
Post by: kiit on 2012-08-02 11:03:50
...about saying that I didn't read the thread... 

Questions are good; comments are good.  This is a forum where inquiries such as these are meant to be explained by people who may know better.


Two things come to mind.

One: This thread is very old, the questions you asked are already ANSWERED IN THIS THREAD! Foobar2000 changed and FIXED that one small issue 5 years ago!

Two: This forum is NOT 'a forum where inquiries such as these are meant to be explained by people who may know better.' That is just what YOU WANT TO HAVE HAPPEN. It is NOT WHY I AM HERE. It is NOT WHY GREYNOL is here!

This forum is for people interested in an intersection between computers (digital) and music (analog), and the software, code, used to make that intersection happen. To share ideas, communicate, and discuss digital audio. It is NOT A FREE SCHOOL OF YOUR CONVENIENCE!

Now your questions have been being answered, many times the answer is to GO LEARN MORE (with URL Links for you to follow up and read!) because we are NOT YOUR TEACHERS.

I understand you want to have friends in far places explain these things to you. Your understanding is very good so far, but show some respect for these REAL PEOPLE who you are pestering with your questions. Most of the data you request is already explained in the wiki and forums.

RESPECT THESE PEOPLE! They are not here just to 'help me learn moar!'.