dougscripts.com

About ID3 Tags

 

ID3 tags are a way to store information about an MP3 file within the file itself. They ensure that information about the file travels with it, whether that's from a back-up CD to hard drive, or from your Mac to a friend's Windows box. iTunes can access this information and displays it in a playlist or browser window and in the Tags display in the Info window of each track: Title, Artist, Album, Genre, Year, Track Number, Comment, etcetera. This is the track data that you can edit manually or via AppleScript.

Originally ID3 tags held just this basic text-only information about a music file. They were a standard size and held standardized information. Now ID3 tags are formatted so that they are capable of storing data as detailed as info on individual musicians performing on the track, graphics data like album cover art, URLs to the publisher and composer, song lyrics, even the musical key of the song and the beats-per-minute. However, pretty much all MP3 players recognize ID3 tag information in a manner that most resembles the earliest ID3 tag format, and because of this there is ample room for confusion.

Currently there are five versions of ID3 tags: v1.0 and v1.1, and v2.2, v2.3, and v2.4. Each successive version attempts to improve on the storage capabilities of the previous version while maintaining backward compatibility. If you are interested in the down and dirty details of ID3 tags, visit the ID3.org website. I warn you, you gotta be really interested to get through some of their specs!

To cut to the chase, this is the format of ID3 Tag v1.0:

ID3 Tag v1.0

Song title

30 characters

Artist

30 characters

Album

30 characters

Year

4 characters

Comment

30 characters

Genre

1 byte

So there's 125 bytes of data and that's the order it must appear in. A player will know that the first 30 bytes is the Song title text (or "string"), the next 30 is the Artist string, etcetera.

Of primary interest here is that you are only allowed 30 characters for Title, Artist, Album, and Comment fields That 1 byte for the Genre field works like this: it can be a number which represents the original predefined ID3 Genre names—how many "Primus", "Pranks", and "Fast Fusion" tracks do you have in your collection?

Since there wasn't really enough useful space alotted to Comment anyway, the next version took two characters away from Comment and created the Track Number field. Here is ID3 Tag v1.1:

ID3 Tag v1.1

Song title

30 characters

Artist

30 characters

Album

30 characters

Year

4 characters

Comment

28 characters

[padding]

1 byte (null)

Album track

1 byte

Genre

1 byte

All that, still packed into just 125 bytes, and still the 30 character limit for Title, Artist, and Album.

The next version of the ID3 tag completely re-wrote the spec, allowing for vast flexibility when including track information, however still maintaining compatibility with MP3 players which still used the v1.x tag format. The v2.x spec is more difficult to illustrate than the v1.x spec above exactly because it is so flexibile. Various information can be stored in "frames" of up to 256 bytes each; each frame begins with an identifier that defines its content. Since these frames can be placed in any order it is up to the player to make sense of the tag data (again, if you are really really really interested... ID3.org).

The upshot of all this is that ID3 v2.x tags can contain Unicode text strings of up to 256 characters. That means your Title, Artist, Album, and Comment fields can be really long if your MP3s use ID3 tag v2.x.

In addition to the longer text strings, items not supported in ID3 v1.x like iTunes' Volume Setting and EQ preset are storable in v2.x, but other players and programs may not be able to access that data. And be aware that Ratings, Play Count, Play Date—items introduced in iTunes 3—and also Start Time and Stop Time are not stored by iTunes in ID3 tags (there is a Ratings "frame" in the v2.x spec, but iTunes doesn't use it because of multiple user complications). Non-ID3 tag data about an MP3 track is stored by iTunes itself and therefore doesn't travel with the MP3 file. You can view most of this non-ID3 Tag data by examining the "iTunes Music Library.xml" file.

What has this got to do with AppleScripting anyway?

It's all about the text strings. The 30 character limit on field length on the v1.x ID3 tags could have an effect on how you work with those fields in AppleScript. Don't forget: name, artist, album, and comment are all elements of track. If you are altering those track data you have to allow for any text limitations of the ID3 tag version. Unfortunately, you can't check or change a track's ID3 tag version in iTunes with AppleScript.

The Apple Knowledge Base also has posted information on problems with "scrambled" text in tags and how to fix it (article #25293), updating when no text appears in tags (article #88186), and general Unicode text problems—mostly fixed in iTunes 2.0.2 (article #60954).

Site contents © 2001 - 2024 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Privacy.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.
The one who says "it cannot be done" should not be interrupting the one who is doing it.