IPB

Welcome Guest ( Log In | Register )

3 Pages V   1 2 3 >  
Closed TopicStart new topic
Difference between Mp3gain and Replaygain
Pootle_1
post Jul 30 2004, 15:46
Post #1





Group: Members
Posts: 34
Joined: 16-June 04
Member No.: 14715



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.

This post has been edited by Pootle_1: Aug 23 2004, 20:48
Go to the top of the page
+Quote Post
Pio2001
post Jul 30 2004, 18:52
Post #2


Moderator


Group: Super Moderator
Posts: 3936
Joined: 29-September 01
Member No.: 73



Experts, do you confirm the above ? Can I include it in the FAQ ?
Go to the top of the page
+Quote Post
Garf
post Jul 30 2004, 18:58
Post #3


Server Admin


Group: Admin
Posts: 4881
Joined: 24-September 01
Member No.: 13



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.
Go to the top of the page
+Quote Post
singaiya
post Jul 30 2004, 19:45
Post #4





Group: Members
Posts: 365
Joined: 21-November 02
Member No.: 3830



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.
Go to the top of the page
+Quote Post
saratoga
post Jul 30 2004, 21:53
Post #5





Group: Members
Posts: 4844
Joined: 2-September 02
Member No.: 3264



QUOTE (singaiya @ Jul 30 2004, 10:45 AM)
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.
*


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.
Go to the top of the page
+Quote Post
singaiya
post Jul 30 2004, 22:11
Post #6





Group: Members
Posts: 365
Joined: 21-November 02
Member No.: 3830



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?
Go to the top of the page
+Quote Post
Hanky
post Jul 30 2004, 23:14
Post #7





Group: Members (Donating)
Posts: 531
Joined: 18-November 01
From: The Netherlands
Member No.: 481



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.

This post has been edited by Hanky: Jul 30 2004, 23:14
Go to the top of the page
+Quote Post
Raja
post Jul 31 2004, 08:27
Post #8





Group: Members
Posts: 54
Joined: 10-July 04
Member No.: 15247



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.
Go to the top of the page
+Quote Post
/\/ephaestous
post Jul 31 2004, 08:52
Post #9





Group: Members
Posts: 648
Joined: 25-October 02
From: Colombia
Member No.: 3620



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.


--------------------
"You have the right to remain silent. Anything you say will be misquoted, then used against you."
Go to the top of the page
+Quote Post
Pootle_1
post Aug 2 2004, 10:35
Post #10





Group: Members
Posts: 34
Joined: 16-June 04
Member No.: 14715



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.
Go to the top of the page
+Quote Post
Pootle_1
post Aug 23 2004, 17:11
Post #11





Group: Members
Posts: 34
Joined: 16-June 04
Member No.: 14715



Added a correction concerning ID3/APE tags after poking foobar2000 with a sharp stick for a few weeks.
Go to the top of the page
+Quote Post
rfarris
post Aug 23 2004, 17:50
Post #12





Group: Members
Posts: 233
Joined: 28-April 04
Member No.: 13771



QUOTE (Pootle)
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.")


--------------------
------- Rick -------
--------------------
Go to the top of the page
+Quote Post
Pootle_1
post Aug 23 2004, 20:58
Post #13





Group: Members
Posts: 34
Joined: 16-June 04
Member No.: 14715



QUOTE (rfarris @ Aug 23 2004, 08:50 AM)
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?
Go to the top of the page
+Quote Post
dreamliner77
post Aug 24 2004, 04:24
Post #14





Group: Members
Posts: 2150
Joined: 29-June 02
From: Boston
Member No.: 2427



QUOTE (/\/ephaestous @ Jul 31 2004, 03:52 AM)
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.
*


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?


--------------------
"You can fight without ever winning, but never win without a fight." Neil Peart 'Resist'
Go to the top of the page
+Quote Post
rfarris
post Aug 24 2004, 19:32
Post #15





Group: Members
Posts: 233
Joined: 28-April 04
Member No.: 13771



QUOTE (Pootle_1 @ Aug 23 2004, 12:58 PM)
QUOTE (rfarris @ Aug 23 2004, 08:50 AM)
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?
*

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

-- Rick


--------------------
------- Rick -------
--------------------
Go to the top of the page
+Quote Post
magic75
post Aug 25 2004, 08:26
Post #16





Group: Members
Posts: 511
Joined: 2-December 02
Member No.: 3959



QUOTE (dreamliner77 @ Aug 23 2004, 07:24 PM)
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.
Go to the top of the page
+Quote Post
kwanbis
post Sep 3 2004, 23:41
Post #17





Group: Developer (Donating)
Posts: 2361
Joined: 28-June 02
From: Argentina
Member No.: 2425



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)?


--------------------
MAREO: http://www.webearce.com.ar
Go to the top of the page
+Quote Post
kwanbis
post Sep 6 2004, 17:36
Post #18





Group: Developer (Donating)
Posts: 2361
Joined: 28-June 02
From: Argentina
Member No.: 2425



UP the question! wink.gif


--------------------
MAREO: http://www.webearce.com.ar
Go to the top of the page
+Quote Post
Pootle_1
post Sep 7 2004, 09:09
Post #19





Group: Members
Posts: 34
Joined: 16-June 04
Member No.: 14715



QUOTE (kwanbis @ Sep 6 2004, 08:36 AM)
i still have some doubts ...

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

Global

QUOTE (kwanbis @ Sep 6 2004, 08:36 AM)
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 (kwanbis @ Sep 6 2004, 08:36 AM)
"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 (kwanbis @ Sep 6 2004, 08:36 AM)
"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 (kwanbis @ Sep 6 2004, 08:36 AM)
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 (kwanbis @ Sep 6 2004, 08:36 AM)
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).

This post has been edited by Pootle_1: Sep 7 2004, 09:10
Go to the top of the page
+Quote Post
kwanbis
post Sep 7 2004, 17:17
Post #20





Group: Developer (Donating)
Posts: 2361
Joined: 28-June 02
From: Argentina
Member No.: 2425



QUOTE (Pootle_1 @ Sep 7 2004, 08:09 AM)
QUOTE (kwanbis @ Sep 6 2004, 08:36 AM)
"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 (kwanbis @ Sep 6 2004, 08:36 AM)
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).
*


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 (Pootle_1 @ Sep 7 2004, 08:09 AM)
QUOTE (kwanbis @ Sep 6 2004, 08:36 AM)
"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 (kwanbis @ Sep 6 2004, 08:36 AM)
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 ... :|


--------------------
MAREO: http://www.webearce.com.ar
Go to the top of the page
+Quote Post
litmitil
post Sep 7 2004, 18:41
Post #21





Group: Members (Donating)
Posts: 27
Joined: 11-April 04
From: Portland, Oregon
Member No.: 13418



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 to write the APE tags at the time of encoding. Then I mp3gain normally and all is right with the world.
Go to the top of the page
+Quote Post
Pootle_1
post Sep 10 2004, 14:10
Post #22





Group: Members
Posts: 34
Joined: 16-June 04
Member No.: 14715



QUOTE (kwanbis @ Sep 6 2004, 08:36 AM)
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!
Go to the top of the page
+Quote Post
ToS_Maverick
post Sep 10 2004, 14:51
Post #23





Group: Members
Posts: 83
Joined: 2-September 04
From: near Vienna
Member No.: 16727



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.


--------------------
member of the "i have a cat-avatar"-group ;)
Go to the top of the page
+Quote Post
singaiya
post Jul 31 2005, 17:17
Post #24





Group: Members
Posts: 365
Joined: 21-November 02
Member No.: 3830



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!
Go to the top of the page
+Quote Post
Bill02888
post Oct 22 2005, 17:07
Post #25





Group: Members
Posts: 65
Joined: 4-June 05
From: Rhode Island, USA
Member No.: 22517



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


This post has been edited by Bill02888: Oct 22 2005, 18:52
Go to the top of the page
+Quote Post

3 Pages V   1 2 3 >
Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 22nd July 2014 - 21:59