Convert replaygain values

I have a mixture of mp3, mp4 and m4a files as correctly tagged as I can manage (the mp3 tagging is ID3v1 and ID3v2.4).
I have used Foobar to replaygain all files.
These files are going to be used for two reasons, to listen to at home using Foobar and on the road using iPod (which I don't have as yet!!)

It is my understanding that iPods cannot read replaygain values but that MP3Tag can be used to convert the replaygain tags into a format which can be read by the iPod.

Can somebody please help me with this conversion process? It should be noted that I am not very comfortable with "scripts" or whatever and if these are required, assistance will be required.

Cheers.

There is an easy way to convert the SOUNDCHECK values to replaygain values instead. This is particularly useful if you prefer ALBUM gain rather than TRACK gain (as I do). You'll need MP3TAG to do the job (a very nice program in general). The instructions below assume you have added album and track replaygain tags to your files (using either fb2k or dbpoweramp or some application, etc.).

  1. First, you'll need a relatively recent (last year or so) build of mp3tag.
  2. Second, you'll need the action that converts the replaygain album number to the soundcheck (Comment ITuneNorm). You should create a new action in MP3TAG. Do this by selecting "convert" from menu (must have a file loaded and selected I think). Then select "Actions". Then you'll see a popup box with a few "actions". Select the icon on upper right side of this box. This is create new action option. Give it a name that makes sense to you (e.g., replaygain action). Then select again the icon on upper right side of this new popup. In the dropdown menu select "format value" formatting the field "COMMENT ITUNENORM" (that is a space between COMMENT and ITUNNORM and you'll have to type this in the box) with the following format string you'll type into the next field below this: $rg2sc(%REPLAYGAIN_ALBUM_GAIN%)

If you want to use replaygain track level simply replace the "ALBUM_GAIN" above with "TRACK_GAIN" (although not worth the effort as track level replaygain and soundcheck values added by itunes are essentially the same). If you want to replace AAC (m4a) files' soundcheck values with the replaygain values all is the same but the field you are formatting is "ITUNNORM" rather than "COMMENT ITUNNORM"

I do this process before importing files into ITUNES. You'll notice that ITUNES no longer takes the time to calculate soundcheck values for each file as it thinks they already exist. If you already have songs in itunes and you want to convert to replaygain values, you can do this too in mp3tag in the same way. The only extra step will be to select (highlight) all songs within ITUNES and then select get info. You won't change anything in the tag boxes simply say OK. This will then cause ITUNES to reread the tags of every file and update its own internal library with the new soundcheck values. I've done this on over 50,000 mp3's in my itunes library and it works great. Obviously, you should set things up and run it on a few files just to confirm your formulas, but all-in-all, a very simple step.

Then again, you can simply do this to save some time:

Save the attached files. 4 of these are separate actions that convert soundcheck values to either track or album gain for either aac or mp3 files. The 5th one is a combo version I use that covers all options for me. It converts soundcheck to replaygain album values whether aac or mp3. It also does a copying of the compilation value to itunescomplilation to be compatible with itunes. This may not be needed any longer as I think this is automatic now within mp3. but it doesn't hurt.

You need to copy these action files to a very specific location in order for mp3tag to see them automatically. And it is NOT the location of the basic program under program files in windows. instead put them in the following directory location:

documents and settings\yourwindowsusername\application data\mp3tag\data\actions

then close and reopen mp3tag. When you click on "convert" then "actions" you should see these new actions as options. Play with them a little and you'll get the idea.

ReplayGain_and_ITUNES_Compilation_Combined_MP3___AAC.mta (281 Bytes)

RG2SC___aac__AlbumGain_.mta (63 Bytes)

RG2SC___aac__TrackGain_.mta (63 Bytes)

RG2SC___mp3__AlbumGain_.mta (71 Bytes)

RG2SC___mp3__TrackGain_.mta (71 Bytes)

Many thanks garym.................where do you guys get your knowledge from?????

Being 65 years old, I am a fully paid up member of the "Boring Old Farts Club" and I have to admit that some of this stuff is an absolute mystery.

As far as I can make out, using your "attached files" works a treat for mp3 and m4a files but seems to avoid mp4's (I'm not sure what software produced them), as I inherited part of my library. (this avoidance took place with the Compilation file but was just fine with the single aac one)

Can you please advise?

Cheers

This is because in the standalone aac version, there is no checking for file type. But in the combined version there is a checking of file type before doing action. Try this version I've attached instead. I added another item that looks for mp4 files. This should work. I can't check as I don't have any mp4 files.

By the way, I'm a member of the old farts club as well. I knew absolutely nothing about all of this stuff 2 years ago, but have learned a tremendous amount just from hanging out at this board (and people helping me out just like I answered your question) and the board over at hydrogenaudio.org and dbpoweramp and squeezebox:
http://www.hydrogenaudio.org/forums/index.php
http://forum.dbpoweramp.com/
http://forums.slimdevices.com/

I essentially use dbpoweramp (ripping to FLAC (home use & archive) and converting to mp3 (mobile use)) > mp3tag (tagging) > foobar2000 (playing/organizing/some utilities) > itunes (syncing with IPOD) or squeezecenter for playing through several squeezeboxes connected to home stereo system.

Just read a lot on these discussion boards and experiment. And always keep backups of your music files, just in case!

ReplayGain_and_ITUNES_Compilation_Combined_MP3___AAC.mta (370 Bytes)

Once again garym, thanks very much

And I figured out what you did

You have been helping me out on the HA forum, for which, thanks

I'm just trying to get my head round Foobar, MP3Tag and the whole album art, embedding, tagging process. These to be followed by iTunes.
If I get comfortable with this stuff the next thing will be classical music, and having looked at the tagging minefield it presents...............................????

My backup is backed up to an external drive.

Cheers

I saw your post on the album art but don't have much to add. I personally keep all my album art embedded in each track. I know some think this is a waste of space (but frankly, we're talking extremely small here). I simply like having the artwork connected with each file no matter where I use the files (ipod, itunes, squeezebox, or some future distribution medium). I too use itunes/ipod for portable uses and the problem you may run into in converting all your art to "folder.jpg" is that itunes doesn't use this approach. So you'll end up having to deal with the itunes approach to art as well as other player's approach to art. But if you embed the art with each file, then you don't have to worry about this. Itunes reads it, foobar reads it, squeezecenter reads it, winamp reads it, windows media player reads it, etc. Anyhow, this is just my personal take on it.

I can't help you with classical tagging. Search around and you'll see lots of discussions on this. I'm a rock, blues, jazz sort of guy.

I have no connection to mp3tag other than being a happy user. I hope if you use this resource a lot, you'll contribute money to keep it going. I have in the past and I'm reminded that I haven't in a while.....so I'm off to do that right now.

I could use help troubleshooting my conversion of replaygain values to itunnorm tags. I can use the previously attached Action and am successful in having the Comment Itunnorm tag generated.

The problem is that when I run the action Mp3tag creates the COMMENT ITUNNORM tag and it changes the DATE tag into a YEAR tag. This causes me to have two YEAR tags and thus the year is displayed inaccurately in Mp3Tag/Foobar.

So how can I prevent Mp3Tag from changing the DATE tag? I have tried changing the newly created YEAR tag back into a DATE tag but Mp3Tag won't allow it.

Thanks for any help!

EDIT
Alright I figured out the problem and the solution.

Mp3Tag was deleting the Date tag (and moving it into the second year field) because I was using ID3v2.4 So I updated the tags to ID3v2.3

After switching to ID3v2.3 I was able to convert the replaygain value to soundcheck with no problem.

Convert ReplayGain Values to iTunes Format

This will use Album gain values if present and converts that value to iTunes format for use with 'Sound Check' enabled in iTunes. If it does not find an Album gain value it then uses the Track gain value and converts that to the iTunes format. If it finds neither Album or Track Gain values the COMMENT ITUNNORM gets erased.

Create a new action with a name like 'ReplayGain to ITUNNORM' and then create a new action type:

Action Type: Format Value

Field: COMMENT ITUNNORM
Format String:

[$rg2sc($if2(%REPLAYGAIN_ALBUM_GAIN%,%REPLAYGAIN_TRACK_GAIN%))]

*Thanks to dano for the improved action.

Hi All

Firstly, thanks for the informative posts above. I've recently upgraded my sound system and am in the process of converting my mp3 collection to ALAC. I will end up with a combination of mp3 & ALAC in my collection.

I previously used MP3GAIN to normalize my mp3 collection and was very happy with the results. I've followed the above steps and I'm still finding some variation in volume between ALAC files and I've also found that MP3 files as a group play significantly quieter than ALAC files? Is this normal or have I done something wrong?

When I play files in Foobar, I can hear a definite difference in volume between before and after applying replaygain values, so I assume I've got this process covered. When I play files in I-tunes pre and post MP3TAG application the differance is not noticeable so I suspect I've messed that step up?

I'm using the mta files kindly provided by garym above which I beleive I have properly loaded into mp3tag. When I run the action, I get an information tag saying "Formatted tags in 2 of 2 files. 0 of 2 files remaned" which I assume means what was supposed to happen has happened?

Any thoughts would be appreciated. I hear a definate 5 to 10dB gain between mp3 and ALAC files when played back thru my ipod nano?

ps - I have switched "sound check" on on both itunes and my ipod.
pps - When I am in itunes and I click "get info" on a track, under summary should the Volume indicate 0dB or another value?

you don't really mean you are converting mp3 to ALAC do you? (that is, taking a lossy file and converting it directly to a lossless file). I assume you mean that you are reripping some disks to ALAC that you previously ripped to mp3. Converting an mp3 file to a lossless format like ALAC or FLAC merely creates a much larger file....it does NOT restore anything that was lost in the mp3 creation process.

There will always be some variation in volume between files, even with replaygain or soundcheck values. RG values just minimize these differences.

this is correct...just the tags are changed, the files are NOT renamed

The only explanation I can think of is that for foobar the RG tags are there and being used properly, but perhaps you weren't successful in creating the ITUNNORM (i.e., soundcheck value) for itunes. Itunes does NOT use RG values and instead uses its own "soundcheck" value. But the file I gave you should convert the RG value to a soundcheck value read by itunes.

In mp3tag, select an ALAC file and an mp3 file. right click, choose extended tags. Do you see a tag called ITUNNORM with a value of a string of numbers, letters like 0000A58 repeated over and over?

I am converting all the files I have (from original CD's) to ALAC but there are a few files I dont have the original media for which is why I will also have some MP3's in the mix.

I checked the "extended tag" as you said and for the MP3 files, I get the bunch of numbers as you said under "COMMENT ITUNNORM". For the ALAC files, the metadata box is completely empty?

I've been using your "ReplayGain_and_ITUNES_compilation combined MP3 & AAC" file. I went back to your original post and wrote an new action for AAC file and when I ran it, I got an ITUNNORM value under "extended tag" so I'm hoping this fixes the problem! Will check it out later today and let you know?

Looks like there may be something wrong with your script in the above mta file? Or maybe just not compatible with my version of mp3tag? It appears to be working on mp3 files, but not the ALAC?

Thanks again for your assistance!

Good! you've probably fixed it with your changes. I doubt my script EVER worked on ALAC files. it was only setup for files with extentions of either .mp3 or .m4a. I assume ALAC files don't have an extension of .m4a. Don't know because I use FLAC files for lossless.
edit: you can add a 3rd line to my action for the ALAC files with correct extension, then the action will work on mp3, m4a, and ALAC files automatically

The ALAC files foobar is creating has a m4a extension. For some reason the script you wrote is not working on these files though? Life was so much easier with just mp3 files! A shame they don't sound as good!

I had still not resolved my volume fluctuating issue with the above steps appearing to not work when I changed from my Wadia 170i Dock back to my Arcam dock and the volume is fine.

All I can boil it down too is the Arcam receives an analogue signal from the ipod (like most docks) but the Wadia takes a digital signal and this signal must be taken before the "sound check" values are added to the volume!

Bummer, as the Wadia provides a great sound, but some songs are just too loud, verging on clipping!

yes, based on what I read, wadia does take a digital signal pass thru from ipod. Mabye its time to move to a squeezebox player for home. Works well with RG tags, the SB Touch plays 24/96 files natively, handles FLAC, ALAC, mp3, AAC, etc. S/PDIF and Optical digital out plus analog out. Can synch multiple rooms or play different things if you have multiple players. I'm very fond of my setup at two different locations.

the script worked and wrote the itunorm field, although it doesn't look like a dB value. what i'm wondering is, i thought the sound check info was written into the iTunesDB file, so does putting into a comment field actually work? (i'm listening to mp3 files on my ipod, converted from flac)

that what happens. the Soundcheck value shows up in a comment field (itunnorm is a comment field) and looks something like:

00004414 00004414 00004414 etc....

That is a repeated block of numbers/letters. It is not a db number, but when these files are imported into ITUNES, itunes reads these values and internally uses these in the itunes database.

One difference is that if you include files in itunes that do not already have these soundcheck comment values, itunes will spend a lot of time scanning for soundcheck info. if the info is already there, it happens very, very fast. p.s. also make sure that you actually have "use soundcheck info" or whatever the menu item it is called, in both itunes program AND for the ipod itself.

edit: and even if you let itunes add the original SOUNDCHECK value, other programs that read that file will show a similar string of numbers in the comment field. Note that there are different "sub fields" for comments. So this itunnorm comment field does not show up in regular COMMENT field in some tag readers (mp3tag for example). But other programs, simply lumps all these things together into one big COMMENT field in terms of display.... bottom line, one can have itunnorm values AND have separate comment info.

thanks. your reply made me wonder. i synced my iPod with mediamonkey and then ran the script on the mp3's that were on the iPod. should that work, or do i have to import those mp3's to itunes and then re-sync them back to the iPod?

not sure, but the safest bet is to run the action to create SoundCheck values from replaygain values on the actual files FIRST. Then import the files to itunes and re-sync them back to ipod. I have no clue how the mediamonkey fits into the mix.

p.s. the only reason to do this entire thing is if you prefer to have ALBUM gain RG values in your ipod. If you're just using TRACK GAIN RG values, you'll find that the SOUNDCHECK values automatically added by itunes (if you turn on that option) are essentially identical to the RG TRACK GAIN values.

And if you listen to a lot of random play stuff on your ipod, you probably do prefer TRACK GAIN values, hence, the entire exercise is not particularly useful for you. There is nothing magical or better about RG values vs Soundcheck values in the realm of "track level gain".