new function to create ITUNSMPB tag?


#1

I love the improved compatibility with iTunes tags, and being able to convert Replaygain tags into an iTunes tag using the function $rg2sc. This greatly reduces my library load times, which I do frequently as I mess with tags and file names.

To further reduce library load times, is it possible to start with the $rg2sc code to create a new function to create the hex data for iTune's gapless tag ITUNSMPB? I apologize if this has been discussed before and I failed to find it, but what little exists on how to create ITUNSMPB is in this thread http://www.hydrogenaudio.org/forums/index....8231&st=136

I'm no programmer, but I hope this is not too difficult to do. It seems like the hard part could be finding out what all the values mean in ITUNSMPB, but I couldn't find that anywhere when searching here or anywhere else. The only threads I found anywhere mentioned how to create a "fake" ITUNSMPB to prevent the iTunes gapless scan, but those methods prevent accurate gapless playback. I'd like to skip the gapless scan but still have accurate gapless playback.

Thanks again for a great tool!


#2

I would like this as well. I think the information at this link defines how to encode ITUNSMPB - maybe Florian can use it to create a new function for this:

http://bitbucket.org/wez/atomicparsley/src/4caecca5cdc6

or maybe Wez can provide Florian some help to do this.


#3

Looking the first link above, the following edited extract from that link seems to define all of the non-zero values for ITUNSMPB:

"[441000.mp3] (a 10 second file with 441000 samples)
TT2: segment1
COM(eng): iTunPGAP=0
TEN: iTunes v7.0.0.70
COM(eng): iTunSMPB= 00000000 00000210 000007C8 000000000006BAA8 00000000 00026783 00000000 00000000 00000000 00000000 00000000 00000000

As (this) MP3 file (has) 385 frames, the number of decoded samples will be 1152 * 385 = 443520 samples (without any handling for gapless playback).
The second and third values in iTunSMPB present the numbers of encoder delay and encoder padding in samples. ...The original sample length: 443520 - 528 (0x210) - 1992 (0x7C8) = 441000 [samples] = 10 [sec].
The forth value in iTunSMPB frame probably represents the original sample length since 0x6BAA8 equals to 441000 [samples].
The sixth value is the byte offset from the first audio frame to the 8th-from-last frame. This provides a resynchronization mechanism to restore a decoder's true sample number after a seek. "

The other values always seem to be all zeros. Is there any other information needed to create a new function for ITUNSMPB?


#4

If reading the mp3 header is not already part of Mp3tag, then reading the header would also be needed, I think. From other posts here, a few links on what the header looks like and a way to read it:

http://gabriel.mp3-tech.org/mp3infotag.html
http://phwip.wordpress.com/home/audio/

Many people use LAME or the LAME header format for mp3 files, so this seems pretty helpful. I don't know what header foramt m4a or other iTunes formats use, but creating this function for files with LAME headers should work for most iTunes users.