PDA

View Full Version : iTunes7, SS6.5, & Volume Adjustment



Gildahl
2006-10-10, 04:46
In SS 6.5 I was (at first) happy to see that it now reads the sound check values from iTunes. With sound check turned on, in SS if I look at the info for the song, I will see a volume adjustment setting like db-4.5, db3.0, etc. If I then turn on the Volume Adjustment by track feature on my squeezebox, it obeys these volume settings. Cool. Unfortunately, I don't like the effect.

So I turned off Sound Check in iTunes, in order to try using the volume adjustment slider in iTunes on a couple tracks to see if manually adjusting the volume might work better for me. Upon turning off sound check (and reimporting) I would have expected to see all the db settings (like db-4.5, db3.0, etc.) be reset to zero; however, they are all still set to the soundcheck values! Consequently, I can't get a clean slate upon which to apply my manual settings since all the tracks still have their soundcheck values.

This seems like a bug, but before I report it as such, I was wondering if I might be doing something wrong here.

Dave

slimpy
2006-10-10, 04:55
I don't use itunes but I understand that slimserver reads the itunes xml file and uses that data to populate its own database. This means you need to force a (clear &) rescan in slimserver to make the changes visible.

Oops, it seems you did rescan already! Does itunes actually remove the volume adjustment values when turning sound check off? I doubt it does so the values are still there and there's probably no way for slimserver to recognize if sound check was turned off in itunes
-s.

Gildahl
2006-10-10, 05:27
Oops, it seems you did rescan already! Does itunes actually remove the volume adjustment values when turning sound check off? I doubt it does so the values are still there and there's probably no way for slimserver to recognize if sound check was turned off in itunes
-s.

Yes, I did do a rescan. I have a suspicion that what you're saying might be true. If so, this might actually be an iTunes issue. I'd love to figure out a way to clear these values, however.

SteveEast
2006-10-10, 05:58
According to the documentation on Sound Check at Apple's site, iTunes does indeed leave the volume adjustment info in place - it just ignores it when Sound Check is switched off. Makes it pretty tough on other applications.

I don't know if you can use, say, foobar200 to strip this info out. I'm certainly not going to experiment by switching Sound Check on!

Steve.

barcar
2006-10-10, 07:03
No warranty given or implied - this is a (potentially painful) destructive process on your iTunes library...

Here's some JavaScript to parse your iTunes library and dispaly tracks with a VolumeAdjustment (SoundCheck) value:


var ITTrackKindFile = 1;
var iTunesApp = WScript.CreateObject("iTunes.Application");
var mainLibrary = iTunesApp.LibraryPlaylist;
var tracks = mainLibrary.Tracks;
var numTracks = tracks.Count;
var i;

while (numTracks != 0)
{
var currTrack = tracks.Item(numTracks);

// is this a file track?
if (currTrack.Kind == ITTrackKindFile)
{
// yes, does it have a volume adjustment?
if (currTrack.VolumeAdjustment != 0)
{
WScript.Echo(currTrack.name + " (" + currTrack.VolumeAdjustment + ")");
}
}

numTracks--;
}
and here's some slightly different JavaScript to actually clear this data out of your iTunes library:


var ITTrackKindFile = 1;
var iTunesApp = WScript.CreateObject("iTunes.Application");
var mainLibrary = iTunesApp.LibraryPlaylist;
var tracks = mainLibrary.Tracks;
var numTracks = tracks.Count;
var i;

while (numTracks != 0)
{
var currTrack = tracks.Item(numTracks);

// is this a file track?
if (currTrack.Kind == ITTrackKindFile)
{
// yes, does it have a volume adjustment?
if (currTrack.VolumeAdjustment != 0)
{
WScript.Echo(currTrack.name + " (" + currTrack.VolumeAdjustment + ")");
currTrack.VolumeAdjustment = 0;
}
}

numTracks--;
}
Hope that helps. I guess I should have done it in Perl but that would have taken me a lot longer...

BarCar

Gildahl
2006-10-10, 16:37
Thank you for a very informative post!

Unfortunately, when I run the second script, it only clears out the manual volume adjustments set by the slider bar. When I reimport, the decibel adjustments apparently made by the sound check action are still there.

barcar
2006-10-11, 05:31
Hmm - I've checked the latest iTunes SDK and that's the only Volume related value they've documented.

If you can post a snippet of the Itunes XML file for affected files I'm happy to look again.

Alternatively there's the worst case option to delete your iTunes database and reimport all your music with Sound Check disabled. Of course that solution is not without it's risks depending on how you have tagged your files.

BarCar.

barcar
2006-10-11, 06:05
Unfortunately, when I run the second script, it only clears out the manual volume adjustments set by the slider bar. When I reimport, the decibel adjustments apparently made by the sound check action are still there.

I've checked in the SlimServer code - it looks like the SlimServer iTunes Importer plugin module takes the iTunes "Volume Adjustment" setting (-100% to +100%) and stores it as a dB value in the REPLAYGAIN_TRACK_GAIN field in SlimServer.

After runnning the second script above can you re-run the first script? It should list no files. This will confirm the script has removed these values correctly from your iTunes library.

And can you confirm you have done a full "clear library and rescan" in SlimServer rather than just looking for new and changed files?

If both these are the case then there are two options I can think of.

One is that iTunes stores the Sound Check information somewhere else (which looking at the SlimServer code doesn't seem to be the case).

The other is that iTunes Sound Check is not to blame and that your tracks may have volume adjustments embedded directly in the tags from another tool (http://wiki.slimdevices.com/index.cgi?page_name=AutomaticVolumeAdjustment). Is that possible?

Gildahl
2006-10-11, 16:55
I can look into these things a bit more deeply if need be, but here are a few observations I made. Note that I have done a full delete/rescan, and I have never used anything but iTunes for tagging my collection.

1. When I look at the iTunes Music Library.xml file, the only tracks that have a volume adjustment tag are those for which I have made volume adjustments using the slider. This implies that the other (sound check) volume settings are stored somewhere else (in the song files themselves, perhaps?).

2. When running the first script, the only tracks that are displayed are ones for which I set the volume using the slider.

3. In iTunes, I set the volume slider to a little over 50 percent for one album and 100 percent for another. Using the first script, the settings for each track on the first album was 58 and the other was 100. When I look in the xml file, these two albums have their values set to 180 and 255 respectively. These make sense.

4. When I look at these same albums (the one set to 58/180 and the one set to 100/255) in Slimserver, all the tracks in the first album are set to 4.00db and the second to 6.02db. Obviously some formula is used to translate to decibel. All pretty understandable, however.

5. After running the second script, the first script no longer shows anything. If I go into iTunes, I will also see that all the sliders are now set to 0. This pretty much demonstrates that the script only operates on the slider values (and does that quite well I might add). Just as an aside, I've always guessed that the soundcheck values were created upon creation of the sound file. You will note that when you turn on sound check in iTunes, there is no processing done, its just a toggle. So iTunes must analyze the file as its being created and assign it some value that expresses its average volume level. This value then gets interpreted when someone turns on the sound check. I also presume that the soundcheck value and the slider value are independent, such that if you have soundcheck turned on, that you can further moderate the volume with the slider (although in the squeezebox it seems that slider values override soundcheck values). If so, then these values must be stored separately.

6. It turns out that iTunes offers a way to achieve the same effect as #5. Simply select all of your tracks and set the slider to zero for all them. This removes all of the Volume Adjustment flags from the xml file and also causes the first script to return no results. Unfortunately, even after doing this, all of the soundcheck values still show-up in Slimserver. I just can't get rid of them.

Given this information, I would like to suggest to Slim Devices that they consider the following functionality for iTunes support.

1. Offer a choice to either obey the soundcheck values or the slider values (or both, additively). Since these are evidently stored separately, this should be easy given that they already apparently know how to get the soundcheck values and the slider values can be easily retrieved from the xml. This setting should be available inside the iTunes options in the server application.

2. Although I didn't personally like the effect of soundcheck, I think it is wonderful that Slimserver offers support for it. One thing that we would all love to have, ut iTunes doesn't support, is volume adjustment by album. But it seems that it might be very easy to emulate this by simply taking the soundcheck values of each track in an album and assigining the average to each track.

In the meantime, I'd still love to know how to just turn off those soundcheck values!!

barcar
2006-10-12, 02:23
Seems I've been throwing you several red-herring. But I think I made some progress last night.

According to http://docs.info.apple.com/article.html?artnum=61655 - depending on the file format, iTunes sometimes stores the normalisation information in the XML and sometimes directly in the file tags.

Of course, Apple being apple they couldn't use the RVAD tag so they have chosen to create a new iTunNORM tag which many editors can't display (hence I was unaware I even had files that had been normalised).

The code to convert iTunes Sound Check information into a dB value seems to be stored in SlimServer\Slim\Utils\SoundCheck.pm. You can see how it arrives at the dB values there.

Querying my SlimServer db I was able, to my surprise, to see that lots of my tracks had Replay Gain data.

Using the Extended Tag mode of Mp3Tag (http://www.mp3tag.de/en/) - which also supports AAC files - I was able to see (and delete) the itunNORM tag on a few files.

This had the effect within SlimServer of instantly (no need to rescan) deleting the "volume adjustment" setting on the info page and the REPLAYGAIN values from the database. iTunes also seems to still play the files fine.

So, where do we go from here...

I can't see any way to access the iTunNorm tag via the iTunes SDK. Looks like they don't publish it as a property you can read or set.

The Mp3Tag tool seems to support some sort of scripting interface (they call them actions). There is a thread (http://www.anytag.de/forums/lofiversion/index.php/t3500.html) on their forums about scripting deletion of this data. I'm going to look into this route to strip these tags.

As to your suggestions...

I agree - there should be a server option to switch on or off the application of replay gain data. Since it was your idea I suggest you raise a feature request at http://bugs.slimdevices.com

It's also not clear to me what happens if you have manual iTunes slider, Sound Check and some other system (e.g. AACgain) adjustments on a file. Which takes priority? Could get messy.

Cheers,

BarCar.

barcar
2006-10-12, 02:35
Ahem. Talk about trying to make something more difficult than it needs to be...

The Mp3Tag tool (http://www.mp3tag.de/en/) allows you to point it at the top level of your music folder and will scan all subfolders and list all files.

You can then use the Extended Tag editor (Alt + T) to remove the ITunNorm tag from all files (or do them in batches if you're a nervous type).

Of course you would want a backup first...

BarCar

kdf
2006-10-13, 08:26
I agree - there should be a server option to switch on or off the application of replay gain data.

player settings -> audio, volume adjustment. you can set this to disable.
-k

barcar
2006-10-13, 08:52
Thanks KDF - I can see that on my SB2 - but it's not an option on my SB1. Does the SB1 ignore replay gain?

kdf
2006-10-13, 09:23
Quoting barcar <barcar.2fmiln1160754901 (AT) no-mx (DOT) forums.slimdevices.com>:

>
> Thanks KDF - I can see that on my SB2 - but it's not an option on my
> SB1. Does the SB1 ignore replay gain?

That's correct. Only SB2 or newer has the ability as it is part of
the firmware.
-kdf

Spies
2006-10-13, 11:17
I wish SlimServer had the built in option to apply replay gain on the server.
That way SliMP3 and Squeezebox1 would have replay gain functionality at
the expense of some server overhead. I have been using jsutula's
"Smart Gain" hack with success for some time now. It was available at
http://www.sutula.us/james/slimserver/ However it only worked with FLAC
files and he has not updated the hack for SlimServer 6.5 yet. If I had the
programing skills I would take this on myself. I understand that I can
purchase a Transporter or a Squeezebox3 to get this feature but I
have invested in a number of SliMP3s and Squeezebox1s and do
not have the disposable income at the moment.

On 10/13/06, kdf <slim-mail (AT) deane-freeman (DOT) com> wrote:
> Quoting barcar <barcar.2fmiln1160754901 (AT) no-mx (DOT) forums.slimdevices.com>:
>
> >
> > Thanks KDF - I can see that on my SB2 - but it's not an option on my
> > SB1. Does the SB1 ignore replay gain?
>
> That's correct. Only SB2 or newer has the ability as it is part of
> the firmware.
> -kdf
>

Gildahl
2006-10-13, 17:39
player settings -> audio, volume adjustment. you can set this to disable.
-k

I know about that. In fact it is what I've had to resort to. What is meant here is the ability to turn off the soundcheck gain, but keep the separate "slider" gain turned on.

barcar
2006-10-14, 01:23
What is meant here is the ability to turn off the soundcheck gain, but keep the separate "slider" gain turned on.

According to resolved bug 3207 (http://bugs.slimdevices.com/show_bug.cgi?id=3207) SlimServer will use the manual slider in preference to Sound Check.

So if you remove the Sound Check data (iTunNorm tags) from your files using Mp3Tag (as discussed above) then it will pay attention to the manual slider values.

If you want the ability to select which gain method is applied then I think you'd need to log a feature request bug.

Tradewind25
2006-12-19, 12:15
I have been struggling with this issue myself recently. This is what I have discovered, and how I have worked around the problem.

Summary
=======
1. iTunes generates some pretty perverse Soundcheck values and stores them in the MP3 tag field: COMMENT ITUNNORM. (In my case these were converted by SS to volume adjustment of anything between -12dB & 3dB for tracks with ostensibly similar volumes.)
2. iTunes generates these values whether or not you tell it to use Soundcheck data on playback or not. (This is the only way that you can "disable" Soundcheck in iTunes.)
3. I figured my best bet was to use iTunes Manual Volume Adjustment option.
4. Whilst Bug 3207 did say that manual adjustment should override Soundcheck data, this (no longer) seems to be the case. (See my updates to that bug at comment#13 and beyond.)
5. I could delete the ITUNNORM data from the MP3 tag, but really wanted to retain it in case it proved to be of some future value.

Workaround
==========
I have used MP3tag to effectively archive the ITUNNORM data to a tag field that I never use (in my case MIXARTIST). This is done using the MP3tag "Actions" mechanism.

1. Definition of the Action Group I called: "Archive ITUNNORM"
1.1 Action type: Format value
Field: MIXARTIST
Formatstring: $if(%comment itunnorm%,%comment itunnorm%,%mixartist%)
1.2 Action type: Remove Fields
Field: COMMENT ITUNNORM

2. Definition of the Action Group I called: "Restore ITUNNORM"
2.1 Action type: Format value
Field: COMMENT ITUNNORM
Formatstring: $if(%mixartist%,%mixartist%,%comment itunnorm%)
2.2 Action type: Remove Fields
Field: MIXARTIST

Notes
- You may use MP3tag to apply either action group to as large a range of mp3 files as you wish.
- Multiple executions of either action group may be made to the same mp3 file.
- The effect is to archive the COMMENT ITUNNORM data to MIXARTIST, or to restore the data should it prove of value in the future.
- Once this ITUNNORM data has been "archived" any manual volume adjustments that you apply via iTunes will be picked up by SS.