INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Solution - ID3v2 Tag writing / computing values.  (Read 2740 times)

yinmeout

  • Junior Woodchuck
  • **
  • Posts: 52
Solution - ID3v2 Tag writing / computing values.
« on: June 22, 2014, 02:13:28 pm »

This is going to be fairly long to explain and so please bear with me. If we can get this answered though, the fruit for the user base will improve 

I am going to talk about Sonos. But the ultimate question is about converting / copying TAG data from one value to another value and saving it into the file.

Background.

I have all four Sonos supported types of file in my library: FLAC, AIFF, ACC, MP3.

Sonos devices (which I use as the rendering devices for my MC database of music) have pretty mediocre Volume Levelling support. They basically read ReplayGain for FLAC files and use “Sound Check” data from iTunes for the other three main file types. (as I am sure anyone delving into this topic knows already).

So in essence this post is to is about how to populate the superior R128 derived values into the appropriate TAG’s which my Sonos rendering devices will then use and read.

Taking the R128 value and writing into the respective tag – according to the file type, I have verified that the following works on my Sonos devices so far:

MP3 = COMMENT ITUNNORM
ACC = iTunNORM
FLAC = REPLAY_TRACK_GAIN
AIFF =  iTunNORM.

I know this is the case as immediately after testing, I deleted the values above from their respective files using MP3TAG and played them again after saving the changes. They were not volume levelled at that point as expected.

Sonos’s information is wrong. They state https://sonos.custhelp.com/app/answers/detail/a_id/330/~/music-playing-and-different-volume-levels that they are reading MP3 (Sound Check data) from the iTunNORM tag and in fact my testing shows they are reading mp3 from COMMENT iTunNORM tag.
They also state that they read from iTunNORM for AIFF files and this is the bones of my ask here. I’ve been using MP3TAG with a custom action to read the R128 values and write them into the respective TAG’s to be read by Sonos. This is fine so far. However AIFF is where I fall over. MP3TAG does not support AIFF files. iTunes (which I don’t want to use and don’t use) only writes Volume Levelling (for AIFF files) (using the inferior 'Sound Check' algorithm) resultant into the itl database, not into the AIFF file tag or the iTunes XML file, as it does not seem that they support ID3v2 tagging for AIFF. So this means:

I need to be instructed how to dynamically calculate a “Sound Check” value from an  R128 value and write that result into an ID3v2 tag called iTunNORM using JRiver, if this is possible.

Second thing. (oh yes, there is more.)

I realised that when I create a new database row iTunNORM, it doesn’t seem to relate to the TAG called iTunNORM. I assert this because values contained in a tag of that name (in a test file) do not end up being displayed in the new database item, of that name. What do I need to know here?

Here is some sample (RAW) tag data using “copy to clip board method”

MP4 Audio File (m4a)
44.1 kHz, 965 kbps, 2 ch
Tool Version: 19.0.128
Tool Name: Media Center
BPM: 59
Volume Level (R128): -15.4224796295166016
Peak Level (R128): +2.0 dBTP; +2.0 Left; +1.7 Right
Track #: 2
iTunNORM:  00008825 00008825 00008825 00008825 00008825 00008825 00008825 00008825 00008825 00008825
Genre:
Dynamic Range (R128): 3.3362600803375244
Album:
 Name: test_m4a_leveled
Rating: 0
Peak Level (Sample): +0.0 dB; +0.0 Left; +0.0 Right
Dynamic Range (DR): 6
Volume Level (ReplayGain): -10.4224796295166016
Artist:
Comment: 5A - 127.99

Try as I might I steadfastly am unable to see how to get the DB to relate to the TAG of the same name, this seems obfuscated from the user in JRiver ?
I am very ignorant on all this so I am sorry if this is obvious.

Guessing, it might not ultimately be relevant to see the value that’s end up in the file TAG, just so long as it’s there and written correctly. But I am hung up on getting this visible as well currently.
Thanks in advance.

p.s. I have considered going to FLAC exclusively to avoid this, but in case you are wondering. . . why all the AIFF fuss. . . the answer is AIFF 'sounds better' at the same bit depth than FLAC does. Most of my good classical recordings are either purchased at, or recorded from vinyl at 92 / 24bit or higher and then downscaled to the maximum Sonos can handle which is 1536 bit AIFF. This is 48khz 16bit. I am unable to hear the difference between the original 96khz FLAC and the downscaled AIFF file produced from it, on my reference (computerised) system which can replay at a true 192 24 natively. However if I downscale to 48khz 16bit FLAC the lack of definition for things like, the placement of vocal soloists in the stereo image, is sadly apparent.
Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: Tag Manipulation and database relationship.
« Reply #1 on: June 22, 2014, 09:59:08 pm »

Apparently (I say this, as I haven't verified it) Media Center can write iTunes Normalization tags to files - but only does this when you are using the handheld device tool to sync with an iPod.
 
I'd really like the option of Media Center writing these tags to the files using R128 data during audio analysis, rather than only when syncing to an iPod.
Logged

yinmeout

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Tag Manipulation and database relationship.
« Reply #2 on: June 23, 2014, 03:47:02 am »

I verified it and that is correct. I took an mp3 album and analysed it - then I synced it to the ipod - when I dump the tag from the ipod it has sound check tag present with populated values. 'Guessing' they will have implemented a specific function to perform that conversion at the point of sync.

Here though, one can I see, derive a database value by selecting the "Calculated Data" radio button from the Manage Library Fields dialogue box. I hope (but I am not sure) that an expression which is built there can calculate the correct Sound Check value and place it into a temporary user created library field. Then the required iTunNorm field / tag can copy it's data from the temporary field. But maybe it can be done in one step. Or maybe not possible at all. . . Which is why I also requested information about the tag field and database relationship - in case I have to manually populate the AIFF Tag's, at least I can write them with j River - even if I have to manually figure out the data via excel.

Quote
I'd really like the option of Media Center writing these tags to the files using R128 data during audio analysis, rather than only when syncing to an iPod.

Yes. . . but can see why they don't bother to write Sound Check values normally - since Sonos is about the only hardware device in the world that seems to use this Volume Levelling Method. (( They (Sonos) have been asked many times to implement consistency in their approach to this.  But I can see that they want to support users moving from a laptop MAC or PC with an iTunes instance to Sonos - which is likely to be a much greater number of customers than the number of customers which have the in depth knowledge required to have R128 or ReplayGain tag data. )) The only other device is iTunes itself (as in the software player) so there is 0 point from J River's perspective in investing the energy to do this and in bloating the users music files with this data, when they have implemented a function to do it perfectly for the hardware players that need it.

It seems I was searching for the wrong thing in my search engine. There are lots of "AIFF ID3v2 editor" hits on that so perhaps one of those will do what I need - but it would be nice to do it in MC.
http://aifftagging.blogspot.co.uk/ edit - most of them only support "specified tags" (excluding the ones of interest here) the kid3 one I tested does not have the ability it seems, to load files from subdirectories - which means editing one CD at a time - OUCH! Can the MC team save us here! ?
Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: Tag Manipulation and database relationship.
« Reply #3 on: June 23, 2014, 04:31:18 am »

Yes. . . but can see why they don't bother to write Sound Check values normally - since Sonos is about the only hardware device in the world that seems to use this Volume Levelling Method.
Well Sonos and any Apple hardware. I don't want to have to do a "sync" to write these tags - I just want to transfer the files via iTunes.
 
I don't see any reason not to write it to the files during analysis.
Logged

yinmeout

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Tag Manipulation and database relationship.
« Reply #4 on: June 23, 2014, 04:50:46 am »

A apologise, I wasn't intending to diminish the relevance or validity of your position /ask, but I can see how what I said came across that way. I was attempting to extrapolate the business logic these guys are applying in their decisions.

I managed to test and verify that Sonos does read and respect the AIFF tag iTunNORM when it contains volume levelling information.
I was able to test using a single file and the Kid3 tag editor. Not an answer yet. . .
Logged

yinmeout

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Solution - ID3v2 Tag writing / computing values.
« Reply #5 on: June 28, 2014, 07:39:31 am »

Since the solution concerns third party code it is posted in that forum here
Logged
Pages: [1]   Go Up