HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: davelasker on 2004-08-01 22:39:13

Title: Convert replaygain to iTunes/iPod volume?
Post by: davelasker on 2004-08-01 22:39:13
I'm an experienced Windows programmer, but a digital audio newbie and also a new iPod owner. I'm trying to normalize playback volume through my iPod.

I tried Apple's Sound Check and didn't like the results. Just turning Sound Check on in the iPod makes its output sound terrible, even before any normalization was done in iTunes.

I'm looking for something like iVolume (Mac-only AFAIK) for Windows that manipulates the volume for each track. I'd like to take a crack at building a fb2k plug-in to do this.

I looked at foo_pod, but it seems they are going the Sound Check route. I'm suffering from the delusion that manipulating volume will give better results than Sound Check. Any truth to this?

Info I'm looking for includes:
a) Where & how is the Volume stored in an Apple .mp4 file? Or is it in the iTunes DB? Any pointers to docs on this would be apprecated.
b) Or would it be easier to use the QuickTime API to set the volume?
c) In either case, how are the replaygain db levels mapped to Apple volume levels???
d) Any other forums where I should be asking this question?

Thanks for the help!

Dave
Title: Convert replaygain to iTunes/iPod volume?
Post by: Aero on 2004-08-01 23:51:18
Quote
I'm an experienced Windows programmer, but a digital audio newbie and also a new iPod owner. I'm trying to normalize playback volume through my iPod.

I tried Apple's Sound Check and didn't like the results. Just turning Sound Check on in the iPod makes its output sound terrible, even before any normalization was done in iTunes.

I'm looking for something like iVolume (Mac-only AFAIK) for Windows that manipulates the volume for each track. I'd like to take a crack at building a fb2k plug-in to do this.

I looked at foo_pod, but it seems they are going the Sound Check route. I'm suffering from the delusion that manipulating volume will give better results than Sound Check. Any truth to this?

There are two ways to manipulate the volume of songs on the iPod.  The first is the way done by EUPod (http://www.espen.se/index.php?subaction=showfull&id=1088783116&archive=&start_from=&ucat=1&category=1) and foo_pod's "Volume Adjustment" preference item.  This boosts the volume only, since as of iPod firmware version 2.2 (at least), there is no way to lower the volume.  This is really only useful for compensating for volume limited iPods, such as those sold in Europe.

Edit: My mistake - you actually can lower the volume.  I could have sworn it didn't work at one point, just I just did a quick test, and in fact, it does work on the iPod (3G, version 2.2).  The range is -255 to 255, so since this is an unsigned 32 bit value, the lowest volume (i.e. silence) is 4,294,967,041.

The second way is through the SoundCheck entry in the iTunesDB.  I'm not sure what you mean by "manipulating volume will give better results than Sound Check", but the SoundCheck field in the iPod database is just a means of  having fine control over the output volume.  foo_pod uses ReplayGain to calculate this value, but you can set this value however you wish.  The only downside (and this can be an upside as well), is that SoundCheck needs to be enabled on the iPod for the volume adjustment to be active.

Actually, I think I do understand.  What the author of iVolume means by it being better than SoundCheck is that he feels that ReplayGain (which iVolume uses) is a better algorithm than the SoundCheck algorithm used in iTunes.  Which is basically correct, since ReplayGain can calculate the volume of an entire album, whereas SoundCheck in iTunes just does per-track gain. 

Note that "SoundCheck" in the iTunesDB is just an unsigned integer value representing the volume gain adjustment in milliWatts, while "SoundCheck" in iTunes is Apple's ReplayGain equivalent.


Quote
Info I'm looking for includes:
a) Where & how is the Volume stored in an Apple .mp4 file? Or is it in the iTunes DB? Any pointers to docs on this would be apprecated.

I don't know about the MP4 container and if it has any volume field, but iTunes uses a field in the iTunesDB.  Download iPodDB (http://otto.homedns.org:8888/iTunes/iPodDB.zip) and look at iPod_mhit::soundcheck.

Quote
b) Or would it be easier to use the QuickTime API to set the volume?

I can't imagine it would be easier than setting the SoundCheck value in the iTunesDB, and it would modify your song.

Quote
c) In either case, how are the replaygain db levels mapped to Apple volume levels???

The C code for converting ReplayGain to SoundCheck is: soundcheck = 1000 * pow(10.0, (-0.1 * gain))


Feel free to contact me if you have any other questions, but from what I understand, foo_pod already done exactly what you are looking for.
Title: Convert replaygain to iTunes/iPod volume?
Post by: davelasker on 2004-08-02 01:50:45
Thanks for the quick and detailed reply.

I see in iTunesDB there are separate entries for soundcheck and volume . I assume volume is the "Volume Adjustment" slider in iTunes GetInfo Options tab??

I was hoping that using volume instead of soundcheck would avoid the huge loss in sound quality that I hear when I turn soundcheck on in my iPod.

Is the algorithm for controlling volume the same as what you gave me for soundcheck?

Thanks for the help!

Dave
Title: Convert replaygain to iTunes/iPod volume?
Post by: Aero on 2004-08-02 02:10:47
Quote
I see in iTunesDB there are separate entries for soundcheck and volume . I assume volume is the "Volume Adjustment" slider in iTunes GetInfo Options tab??

That's correct. 

The mhit::volume and mhit::soundcheck database items both affect the iPod volume.  The difference between them is that the soundcheck volume adjustment can be turned off by disabling Sound Check on the iPod, whereas volume is always active.  Also, volume seems to be more arbritrary (-100% to 100%) while soundcheck is a actual gain value.


Quote
I was hoping that using volume instead of soundcheck would avoid the huge loss in sound quality that I hear when I turn soundcheck on in my iPod.

I don't use iTunes, but I don't believe that it affects sound quality.  The biggest problem with iTunes' Sound Check implementation is that it does a per-track normalization, so quiet songs on an album sound at the same level as loud songs.  ReplayGain also has a track gain mode, but most people use the album mode.  In my experiments, iTunes' Sound Check gain values are very close to what ReplayGain calculates, so the biggest difference is the track vs. album gain.

So if that is what you mean by affecting the sound quality, then I agree that per-track gain is bad (in general).  But I haven't noticed any degradation in audio quality simply by enabling Sound Check on the iPod, using ReplayGain values sent by foo_pod.

Quote
Is the algorithm for controlling volume the same as what you gave me for soundcheck?

No, the algorithm I posted is for ReplayGain -> soundcheck.

mhit::volume is simply a value from -255 to 255, which corresponds to a volume adjustment of -100% to 100%.  So if you want a song to be 20% louder, you would set volume to 51 (0.2 * 255).
Title: Convert replaygain to iTunes/iPod volume?
Post by: Otto42 on 2004-08-04 17:06:02
Quote
I was hoping that using volume instead of soundcheck would avoid the huge loss in sound quality that I hear when I turn soundcheck on in my iPod.[a href="index.php?act=findpost&pid=230995"][{POST_SNAPBACK}][/a]

I'm going to have to call shenanigans and refer you to rule 8 here. If you're claiming that there's a huge loss in sound quality when you enabled sound check on the iPod, I think you should back it up with some actual testing results. I certainly can't hear any difference when the soundcheck value is set to zero, meaning that the volume doesn't change any. This is just me switching soundcheck on and off while listening, mind you.

If you are hearing real differences, then I'd say you might have a busted iPod and you should consider an exchange. Soundcheck should not affect sound quality.

Aero: Are you sure it's a 255 range? I thought it was -100 to 100, actually. I haven't tried changing it in iTunes and checking the results, however.
Title: Convert replaygain to iTunes/iPod volume?
Post by: davelasker on 2004-08-09 19:03:58
When I first got my iPod, I intended to use soundcheck. I turned in on in my iPod, but never go around to soundchecking my iTunes library.

I then played back some tracks on my home stero, connecting the iPod with the dock connecter line out. I compared the sound of an original CD on my CD player with the iPod. The CD was ripped with iTunes as a 128KB AAC.

The iPod sounded like the high frequencies were extremely attenuated.

I searched iPodLounge and found a few posts indicating that soundcheck degraded sound quality. So I turned it off and repeated the above test. With soundcheck off in the iPod the results were much improved - the iPod sounded very close to the CD.

Given my results and the iPodLounge comments, I never went any further. Being a newbie, I assumed this was common knowledge, and gave up on soundcheck. I also noticed that iVolume for MAC set the volume rather than using soundcheck. But it may be just a case of published iTunes and QuickTime API's supporting volume but not supporting soundcheck.

Is there any resonable explaination for what I have observed? Any suggestions for how I could measure my results, without any equipment other than my PC?

My apologies if I offended anyone.

Thanks for the help!

Dave

P.S. I've experimented reading and writing the volume in iTunes using its COM API for Windows, and the range appears to be +/-100.

Quote
Quote
I was hoping that using volume instead of soundcheck would avoid the huge loss in sound quality that I hear when I turn soundcheck on in my iPod.[a href="index.php?act=findpost&pid=230995"][{POST_SNAPBACK}][/a]

I'm going to have to call shenanigans and refer you to rule 8 here. If you're claiming that there's a huge loss in sound quality when you enabled sound check on the iPod, I think you should back it up with some actual testing results. I certainly can't hear any difference when the soundcheck value is set to zero, meaning that the volume doesn't change any. This is just me switching soundcheck on and off while listening, mind you.

If you are hearing real differences, then I'd say you might have a busted iPod and you should consider an exchange. Soundcheck should not affect sound quality.

Aero: Are you sure it's a 255 range? I thought it was -100 to 100, actually. I haven't tried changing it in iTunes and checking the results, however.
[a href="index.php?act=findpost&pid=231834"][{POST_SNAPBACK}][/a]
Title: Convert replaygain to iTunes/iPod volume?
Post by: JohanDeBock on 2006-03-21 17:17:25
This is something I just made for people that still use iTunes for their ipod management, but also want to use Replay Gain.

http://uclc.info/ipod/ (http://uclc.info/ipod/)

Usage:
ipodrg.exe file.mp3 a      for Album Gain
ipodrg.exe file.mp3 t      for Track Gain

If it finds a Replay Gain tag AND a Sound Check tag,
it alters the Sound Check tag to match the Replay Gain value.

Thanks to Otto42, Mike Giacomelli, Aero and anyone I forgot at Hydrogenaudio for clearing out the converion formula.

I still don't know what all the values in the iTunNORM tag mean so I just replace them all with the Replay Gain value.
What I do know is that all those values seem to have an effect on the dB value given by Get Info in iTunes.

Feel free to debug, add features, ...

The rgsc program is a simple program that gives a list of all the tracks in an iTunesDB file together with their Sound Check value.
Usage:
rgsc iTunesDB
Title: Convert replaygain to iTunes/iPod volume?
Post by: SNAG on 2006-04-13 04:42:03
This is something I just made for people that still use iTunes for their ipod management, but also want to use Replay Gain.

http://uclc.info/ipod/ (http://uclc.info/ipod/)

Usage:
ipodrg.exe file.mp3 a      for Album Gain
ipodrg.exe file.mp3 t      for Track Gain

If it finds a Replay Gain tag AND a Sound Check tag,
it alters the Sound Check tag to match the Replay Gain value.

Thanks to Otto42, Mike Giacomelli, Aero and anyone I forgot at Hydrogenaudio for clearing out the converion formula.

I still don't know what all the values in the iTunNORM tag mean so I just replace them all with the Replay Gain value.
What I do know is that all those values seem to have an effect on the dB value given by Get Info in iTunes.

Feel free to debug, add features, ...

The rgsc program is a simple program that gives a list of all the tracks in an iTunesDB file together with their Sound Check value.
Usage:
rgsc iTunesDB


Hi, thanks for the program, it's going to be a godsend to me.

Just to ask, is there any way to batch re-tag the Soundcheck files that I have? Typing the command for thousands of files is going to kill me..

Just a suggestion: It would be great if a FB2K plugin could be created to also automatically write the relevant Soundcheck values into the MP3 file(s) when RG is applied to them.
Title: Convert replaygain to iTunes/iPod volume?
Post by: david_dl on 2006-04-13 04:56:16
Just to ask, is there any way to batch re-tag the Soundcheck files that I have? Typing the command for thousands of files is going to kill me..


Code: [Select]
FOR /R %1 IN (*.mp3) DO ipodrg.exe %1 a
Title: Convert replaygain to iTunes/iPod volume?
Post by: JohanDeBock on 2006-04-13 08:32:37

Just to ask, is there any way to batch re-tag the Soundcheck files that I have? Typing the command for thousands of files is going to kill me..


Code: [Select]
FOR /R %1 IN (*.mp3) DO ipodrg.exe %1 a



If you use spaces in your filenames you must also use quotes around %1 like this:
Code: [Select]
FOR /R %1 IN (*.mp3) DO ipodrg.exe "%1" a


If you want to easily check for errors afterwards you can use this command:
Code: [Select]
FOR /R %1 IN (*.mp3) DO ipodrg.exe "%1" a >> c:\somedir\log.txt


Then check afterwards in the log.txt file.
Title: Convert replaygain to iTunes/iPod volume?
Post by: SNAG on 2006-04-13 18:48:52


Just to ask, is there any way to batch re-tag the Soundcheck files that I have? Typing the command for thousands of files is going to kill me..


Code: [Select]
FOR /R %1 IN (*.mp3) DO ipodrg.exe %1 a



If you use spaces in your filenames you must also use quotes around %1 like this:
Code: [Select]
FOR /R %1 IN (*.mp3) DO ipodrg.exe "%1" a


If you want to easily check for errors afterwards you can use this command:
Code: [Select]
FOR /R %1 IN (*.mp3) DO ipodrg.exe "%1" a >> c:\somedir\log.txt


Then check afterwards in the log.txt file.


Gee, thanks for the reply. Just to check, do I type this command in the MS-DOS prompt?

I suppose this command would not be able to parse through any MP3 files in the subfolders I suppose..
Title: Convert replaygain to iTunes/iPod volume?
Post by: foosion on 2006-04-13 19:19:48
MS-DOS wouldn't help, but cmd.exe will do.

The /R switch makes it recurse into subdirectories.
Title: Convert replaygain to iTunes/iPod volume?
Post by: JohanDeBock on 2006-04-14 11:09:12
An extra tip, you should place the directory location of ipodrg.exe in the PATH environment variable. Then it can be executed easily from every directory.
-change the path permanently in System Properties, Advanced, Environment variable
-or type:
Code: [Select]
set PATH=%PATH%;c:\utils
in the Command Prompt

and place ipodrg.exe in c:\utils
Title: Convert replaygain to iTunes/iPod volume?
Post by: SNAG on 2006-05-02 13:47:03
An extra tip, you should place the directory location of ipodrg.exe in the PATH environment variable. Then it can be executed easily from every directory.
-change the path permanently in System Properties, Advanced, Environment variable
-or type:
Code: [Select]
set PATH=%PATH%;c:\utils
in the Command Prompt

and place ipodrg.exe in c:\utils

Hi there,

Attempted to use your program just now, but I got the following error msgs:

D:\My Music>ipodrg.exe "D:\My Music\iPod\Take The Lead Soundtrack\Jae Millz, Jun
e Christy, Eric B & Rakim, And Mashonda - I Like That You Cant Take That Away Fr
om Me.mp3" a  1>>d:\log.txt

'ipodrg.exe' is not recognized as an internal or external command,
operable program or batch file.

Any suggestions on solving the problem?
Thanks..


EDIT: It works now.. I was in the wrong folder.
Just to check, would it be possible to modify the program such that it will be able to convert *any* type of RG into SoundCheck values?

I realise that I have to run the program twice - once for Album Gain, and once for Track Gain..
Title: Convert replaygain to iTunes/iPod volume?
Post by: JohanDeBock on 2006-05-03 13:19:22
EDIT: It works now.. I was in the wrong folder.
Just to check, would it be possible to modify the program such that it will be able to convert *any* type of RG into SoundCheck values?

I realise that I have to run the program twice - once for Album Gain, and once for Track Gain..


You can only use one of the Replaygain values for conversion to the Soundcheck value. The iPod only recognizes one Soundcheck value.
If you first run it for Album Gain and then for Track Gain, it will overwrite the Album Gain value.
Title: Convert replaygain to iTunes/iPod volume?
Post by: magnusak on 2006-05-31 11:40:01
I run the utility to convert replay gain to Sound Check and get the following error:

Code: [Select]
Filename: D:\temp\replay gain\Alicia Keys\Alicia Keys - The Diary of Alicia Keys - 2003\15 - Alicia Keys - Nobody Not Really.mp3
Album Gain: -6.590000
Sound Check: 000011D0
ERROR: Sound Check tag not found!


Any ideas?
Title: Convert replaygain to iTunes/iPod volume?
Post by: JohanDeBock on 2006-05-31 21:27:01
I run the utility to convert replay gain to Sound Check and get the following error:

Code: [Select]
Filename: D:\temp\replay gain\Alicia Keys\Alicia Keys - The Diary of Alicia Keys - 2003\15 - Alicia Keys - Nobody Not Really.mp3
Album Gain: -6.590000
Sound Check: 000011D0
ERROR: Sound Check tag not found!


Any ideas?


Did you first let iTunes write a Sound Check tag to the mp3?
Title: Convert replaygain to iTunes/iPod volume?
Post by: magnusak on 2006-06-01 09:39:57
Did you first let iTunes write a Sound Check tag to the mp3?
No. Do I have to?
Title: Convert replaygain to iTunes/iPod volume?
Post by: JohanDeBock on 2006-06-01 09:59:43

Did you first let iTunes write a Sound Check tag to the mp3?
No. Do I have to?


Yes.
Title: Convert replaygain to iTunes/iPod volume?
Post by: magnusak on 2006-06-01 17:10:32


Did you first let iTunes write a Sound Check tag to the mp3?
No. Do I have to?


Yes.

Is there a design reason for this, or is it simply because it's hard to add ID3v2 tags? By the way, do you (or anyone) know exactly which tag iTunes adds? It seems easier to just add dummy tags with Mp3Tag or some other tagger instead of having to run through a useless SoundCheck with iTunes (on my 80 gig collection).

Btw, it wouldn't it be nice if the replay gain scanner of foobar just did this for us? Is this opensource? Would it be possible to just hack into this dll or hook onto some event of any kind?
Title: Convert replaygain to iTunes/iPod volume?
Post by: JohanDeBock on 2006-06-01 19:51:46
Is there a design reason for this, or is it simply because it's hard to add ID3v2 tags? By the way, do you (or anyone) know exactly which tag iTunes adds? It seems easier to just add dummy tags with Mp3Tag or some other tagger instead of having to run through a useless SoundCheck with iTunes (on my 80 gig collection).

Btw, it wouldn't it be nice if the replay gain scanner of foobar just did this for us? Is this opensource? Would it be possible to just hack into this dll or hook onto some event of any kind?


I just made this for my own needs, feel free to change anything you want.
Title: Convert replaygain to iTunes/iPod volume?
Post by: Otto42 on 2006-06-02 17:38:19
By the way, do you (or anyone) know exactly which tag iTunes adds?

It adds a somewhat weird comment field (COMM) that most other tagging programs end up ignoring.

Frankly, this all seems a bit pointless to me. In the few tests I've done, ReplayGain did not return results that were substantially different from the results Sound Check returns. Maybe a few percentage points here and there, but for the most part the results were close enough that I'd have my doubts about anybody being able to tell any real difference.

Anybody want to compare the Sound Check results and the ReplayGain results on a wide selection of tracks? I just think we're into the realm of placebo here, except for a few problem samples, of course. I may try writing some programs to build some spreadsheets of my data and such this weekend, and see for myself.

Edit: Of course, the Album Gain is going to be different. If you're using this sort of thing to force iTunes/iPod to use an Album Gain, then that makes perfect sense. I think the Track Gain values will be similar though.
Title: Convert replaygain to iTunes/iPod volume?
Post by: =trott= on 2006-06-02 21:38:22
I've been looking for a while now to remove soundcheck tags. When aacgain came out I had the brilliant idea to apply the album gain value to all tracks. Which (mostly) worked, but of course several of those tracks were already in my itunes db and already had a soundcheck value. After aacgain finished with them, the overall volume was decreased. As a result, these tracks are much too silent now.
So far, I only managed to do it by removing them from the library, removing the tag with a tagging program and then re-importing them. Which is time-consuming to say the least. Especially since I don't know which tracks have the problem. (not to mention that aacgain made some seriously wrong decisions with some tracks).
So, even if only for removing the soundcheck value, this would be useful. Apparantly I won't be able to use it for this purpose, it would be great if somebody could add the functionality.
Besides, even if soundcheck and RG tags would be practically the same, this would (for me) be even better. I use another tagger than itunes in any case because of extra functionality, so I could add the volume adjustment and all tags + cover art and then import the whole lot into itunes and be done with it...
Title: Convert replaygain to iTunes/iPod volume?
Post by: magnusak on 2006-06-05 07:55:32
Edit: Of course, the Album Gain is going to be different. If you're using this sort of thing to force iTunes/iPod to use an Album Gain, then that makes perfect sense. I think the Track Gain values will be similar though.

Hi Otto. I have two reasons for using Replay Gain instead of soundcheck.

1. I prefer the Album Gain feature to the Track Gain.
2. Replay Gain is supported by my favourite music player for windows.

Cheers,
Magnus
Title: Convert replaygain to iTunes/iPod volume?
Post by: saratoga on 2006-06-06 20:29:31
By the way, do you (or anyone) know exactly which tag iTunes adds?

It adds a somewhat weird comment field (COMM) that most other tagging programs end up ignoring.

Frankly, this all seems a bit pointless to me. In the few tests I've done, ReplayGain did not return results that were substantially different from the results Sound Check returns. Maybe a few percentage points here and there, but for the most part the results were close enough that I'd have my doubts about anybody being able to tell any real difference.



I guess it'd be nice for album gain (track gain drives me nuts), but yeah for trackgain, I doubt theres a huge difference.

What the name of that field?  Can the foobar masstagger write that to ID3 or is it a field type foobar does not write?
Title: Convert replaygain to iTunes/iPod volume?
Post by: dano on 2006-06-07 00:55:38
It's just a comment frame with the description iTunNORM, nothing weird about that.

Mp3tag can add "dummy" iTunNORM comment fields, but it must be done in a certain way.
In can't be done in foobar because it doesn't support ID3v2 comment frame descriptions.
Title: Convert replaygain to iTunes/iPod volume?
Post by: Skates on 2006-08-18 21:14:51
What's this certain way of adding the dummy tag using Mp3tag? I don't want iTunes to rewrite my tags...
Title: Convert replaygain to iTunes/iPod volume?
Post by: dano on 2006-08-18 22:09:30
Ok, some time has passed and it has become a bit easier now, but you need the version 2.36d from http://developer.mp3tag.de/ (http://developer.mp3tag.de/)

1. Select your files and press ALT+T
2. Create a new field with the name COMMENT ITUNNORM
3. Fill in a fake soundcheck value like:
" 00000F0A 000003E2 000054FF 00003C89 00008AFA 00006158 0000842C 000084CF 0002FF0A 0001DDC1"
(without the " signs)
Note: There is a space at the beginning of the value!
Title: Convert replaygain to iTunes/iPod volume?
Post by: incripshin on 2006-09-21 05:21:06
For those who use linux, or have cygwin installed, I wrote a nice script for ipodrg (using album replaygain):

Code: [Select]
#!/bin/bash

find -regex '^.*\.mp3$' > file_list

for i in $(seq 1 $(wc file_list | awk '{print $1}')); do
  FILE=$(head -n${i} file_list | tail -n1)
  ipodrg "${FILE}" a
done

rm file_list


Just put your ipodrg executable in /usr/local/bin.  Many thanks to Johan!  Now I just have to figure out how to get rid of those squares at the end of tags in iTunes, when the tags were written in foobar.  I had my fingers crossed that iTunes 7 would fix this, but I was let down.

Mark
Title: Convert replaygain to iTunes/iPod volume?
Post by: W.A.B. on 2006-09-25 17:06:28
Ok, some time has passed and it has become a bit easier now, but you need the version 2.36d from http://developer.mp3tag.de/ (http://developer.mp3tag.de/)

1. Select your files and press ALT+T
2. Create a new field with the name COMMENT ITUNNORM
3. Fill in a fake soundcheck value like:
" 00000F0A 000003E2 000054FF 00003C89 00008AFA 00006158 0000842C 000084CF 0002FF0A 0001DDC1"
(without the " signs)
Note: There is a space at the beginning of the value!

OK, dano & I recently worked out that this only works in mp3tag if you use the iso option for ID3 v2.3 Tag.

UTF 16 & UTF 8 will create the field & value  but ipodrg.exe couldn't recognize that as an itunesNorm tag, you'll get an error message, soundcheck tag missing or similar.

I have still one problem:

Johan's command line only works in the cmd windows
FOR /R %1 IN (*.mp3) DO ipodrg.exe "%1" a >> "C:\Replaylog.txt"

If I put this code into a batch file like this it doesn't work for syntactical reason => (*.mp3) doesn't work at this point for syntactic reasons.

Do you have a tip that it will work in a batch file?
Thanks
Wolfgang

Batch (the path ipodrg.exe is already set in the environment)
del "C:\Replaylog.txt"
c:
cd "\1980"
FOR /R %1 IN (*.mp3) DO ipodrg.exe "%1" a >> "C:\Replaylog.txt"
Title: Convert replaygain to iTunes/iPod volume?
Post by: karl_lillevold on 2006-12-08 23:21:56
It's too bad ipodrg does not work with MPEG4 tags
Title: Convert replaygain to iTunes/iPod volume?
Post by: dano on 2006-12-20 14:22:13
It's now also possible to use only Mp3tag for the job (v2.37c required). Works also for AAC in mp4 container.

If you have added RG-tags with foobar2000, you can get the sound check values with the new $rg2sc() function:
$rg2sc(%REPLAYGAIN_TRACK_GAIN%)
$rg2sc(%REPLAYGAIN_ALBUM_GAIN%)
Title: Convert replaygain to iTunes/iPod volume?
Post by: Prodoc on 2006-12-20 14:55:42
It's now also possible to use only Mp3tag for the job (v2.37c required). Works also for AAC in mp4 container.

If you have added RG-tags with foobar2000, you can get the sound check values with the new $rg2sc() function:
$rg2sc(%REPLAYGAIN_TRACK_GAIN%)
$rg2sc(%REPLAYGAIN_ALBUM_GAIN%)

Sounds great :-)
What's the preferred working order to prevent iTunes from touching any of the tags? Should SoundCheck be enabled before or after the values are converted in Mp3tag?
Title: Convert replaygain to iTunes/iPod volume?
Post by: karl_lillevold on 2007-01-01 21:16:14
It's now also possible to use only Mp3tag for the job (v2.37c required). Works also for AAC in mp4 container.

Pretty nice. Seems to work as expected. However, interaction with iTunes is problematic:
1) iTunes does not re-read the tag after it's been modified with mp3tag, probably since iTunes keeps the tag info in its own database.
2) If deleting the files from the iTunes database, then re-importing the songs, iTunes recalculates and overwrites the ITUNNORM tag. Thus, back to square one...
Title: Convert replaygain to iTunes/iPod volume?
Post by: dano on 2007-01-01 23:26:27
I currently have iTunes 7.0.2.16

1) It reads the tag again if I do right click > Information or if I just play the file it uses the new volume.
2) Also negative here. No recalculation is done.

Note: For mp3 you must use iso-8859-1 tag encoding in Mp3tag at the moment and AAC files should have m4a extension.
Title: Convert replaygain to iTunes/iPod volume?
Post by: karl_lillevold on 2007-01-01 23:52:29
dano: I think my "Replace with regular expression" function is not set up correctly in mp3tag...  After I run it, ITUNNORM changes to 000003E8 000003E8 ... ... ... no matter what the RG album gain is. Could you please indicate how you are using the function in mp3tag?
Title: Convert replaygain to iTunes/iPod volume?
Post by: dano on 2007-01-02 00:43:26
Ok I've uploaded the 4 possible actions here (http://www.nub4life.net/uploads/tag/actions/rg2sc.zip).
Extract to
%APPDATA%\Mp3tag\data\actions
Title: Convert replaygain to iTunes/iPod volume?
Post by: karl_lillevold on 2007-01-02 00:53:09
Excellent. Everything works fine now. Thanks!
Title: Convert replaygain to iTunes/iPod volume?
Post by: LadFromDownUnder on 2007-01-07 09:31:10
So let's say I wanted to do the following:

1. Run ReplayGain calculation (in either Album or Track mode - specifiable) and write the relevant values to ID3 or APE  tags.
2. Read the tags just created and write the COMMENT ITUNNORM tag (based on the RG to SC formula).

And I wanted to do it in Windows, via a batch file or preferably, VBScript.

I'm not opposed to writing something myself if such a mechanism doesn't already exist, but I'm keen to leverage what I can.

Any suggestions?
Title: Convert replaygain to iTunes/iPod volume?
Post by: riffmaker on 2007-02-13 19:23:57
An extra tip, you should place the directory location of ipodrg.exe in the PATH environment variable. Then it can be executed easily from every directory.
-change the path permanently in System Properties, Advanced, Environment variable
-or type:
Code: [Select]
set PATH=%PATH%;c:\utils
in the Command Prompt

and place ipodrg.exe in c:\utils


Hi. Im trying to make batch file for ipodrg.exe whole day, but it is still not working...

Can you please, send me full example of batch file and settings? (i thought it would be easy, but i cant figure it out...) thanks
---

And one more question: does replaygain and soundcheck save to same id3 field? Or if I add replaygain info and iTunes rewrites my mp3s soundcheck info, I can get it back by running ipodrg batch again?
Title: Convert replaygain to iTunes/iPod volume?
Post by: swyn on 2007-04-18 04:24:18

An extra tip, you should place the directory location of ipodrg.exe in the PATH environment variable. Then it can be executed easily from every directory.
-change the path permanently in System Properties, Advanced, Environment variable
-or type:
Code: [Select]
set PATH=%PATH%;c:\utils
in the Command Prompt

and place ipodrg.exe in c:\utils


Hi. Im trying to make batch file for ipodrg.exe whole day, but it is still not working...

Can you please, send me full example of batch file and settings? (i thought it would be easy, but i cant figure it out...) thanks
---

And one more question: does replaygain and soundcheck save to same id3 field? Or if I add replaygain info and iTunes rewrites my mp3s soundcheck info, I can get it back by running ipodrg batch again?


If you just want to do it from the command line, I use:
for %f in (*.mp3) do path\to\ipodrg.exe "%f" t
Example: for %f in (*.mp3) do d:\util\ipodrg.exe "%f" t

If you want to use the above line in a batch file, you need to use double % for the variable like as follows:
for %%f in (*.mp3) do d:\util\ipodrg.exe "%%f" t

Quote
It's now also possible to use only Mp3tag for the job (v2.37c required). Works also for AAC in mp4 container.


I have tried using Mp3tag (v2.37j) to create SoundCheck tags and for some reason the files that were attached weren't doing it for me, so I made an Action (Convert -> Actions) that seems to do the trick.  No pre-scanning with iTunes required.

Under actions, create a new group. (RG to SoundCheck or something similar)
Create a new action and choose 'Format Value'.
In the field, enter COMMENT ITUNNORM
And the format string $rg2sc(%REPLAYGAIN_TRACK_GAIN%)
And you're done.

Run the action on any file with replaygain tags (from foobar or whatever) and the SoundCheck comment will be added if it doesn't exist or changed to match the replaygain value.
Title: Convert replaygain to iTunes/iPod volume?
Post by: dhartson on 2008-01-11 11:12:04
I was having trouble running ipodrg from the command line until I used the example given by swyn to come up with:
FOR /R %f IN (*.mp3) DO c:\utils\ipodrg.exe "%f" a
and
FOR /R %f IN (*.mp3) DO c:\utils\ipodrg.exe "%f" a >> "c:\utils\log.txt"

However, I am not able to generate a report using the rgsc utility, presumably the usage is:
rgsc iTunesDB
But that evidently assumes I know more than I do, because I am not able to get any results using the rgsc utility. I either get an error: "ERROR: Could not open input file!" (when I literally used "iTunesDB"), or I get a "0" result when I used "rgsc iTunes Library.itl" from the directory in which the file is located -
C:\Documents and Settings\David\My Documents\My Music\iTunes
The result: "Amount of tracks: 0"

So, I am doing something very wrong. When I ran the ipodrg utility to create "log.txt" (second cmd line, above), a text file with all my mp3 songs was created with both the values, for example:
Filename: D:\Music\Carole King\Tapestry\02 - So Far Away - Carole King - Tapestry.mp3
Album Gain: -4.750000
Sound Check: 00000BA9
Lots and lots of tracks with both album gain and sound check values.

So please advise how to properly write the cmd line to use the rgsc utility. Thanks.