Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Convert replaygain to iTunes/iPod volume? (Read 84925 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Convert replaygain to iTunes/iPod volume?

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

Convert replaygain to iTunes/iPod volume?

Reply #1
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 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 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.

Convert replaygain to iTunes/iPod volume?

Reply #2
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

Convert replaygain to iTunes/iPod volume?

Reply #3
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).

Convert replaygain to iTunes/iPod volume?

Reply #4
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.

Convert replaygain to iTunes/iPod volume?

Reply #5
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]

Convert replaygain to iTunes/iPod volume?

Reply #6
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/

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

Convert replaygain to iTunes/iPod volume?

Reply #7
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/

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.

Convert replaygain to iTunes/iPod volume?

Reply #8
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

Convert replaygain to iTunes/iPod volume?

Reply #9

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.

Convert replaygain to iTunes/iPod volume?

Reply #10


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..

Convert replaygain to iTunes/iPod volume?

Reply #11
MS-DOS wouldn't help, but cmd.exe will do.

The /R switch makes it recurse into subdirectories.

Convert replaygain to iTunes/iPod volume?

Reply #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

Convert replaygain to iTunes/iPod volume?

Reply #13
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..

Convert replaygain to iTunes/iPod volume?

Reply #14
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.

Convert replaygain to iTunes/iPod volume?

Reply #15
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?

Convert replaygain to iTunes/iPod volume?

Reply #16
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?



Convert replaygain to iTunes/iPod volume?

Reply #19


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?

Convert replaygain to iTunes/iPod volume?

Reply #20
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.

Convert replaygain to iTunes/iPod volume?

Reply #21
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.

Convert replaygain to iTunes/iPod volume?

Reply #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...

Convert replaygain to iTunes/iPod volume?

Reply #23
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

Convert replaygain to iTunes/iPod volume?

Reply #24
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?