\documentclass[oneside,titlepage]{article}

\usepackage{common}
\usepackage[ps2pdf]{hyperref}

\author{darkness}
\title{\textbf{Standards for ID3 Tags}}
\date{Version 0.5.1\\Last revised: September 13, 2006\\Generated: \today}

\begin{document}

\maketitle

\tableofcontents
\newpage

\section{Introduction}

This document is intended to provide standards for the use of ID3 tags
in MPEG 1 Layer III audio.  This document is not a reference for ID3
or the MPEG format.  This document heavily references ``Standards for
Music Information'' \cite{SMI} for purposes of data acquisition and
formatting.  Fields from \cite{SMI} are referred to as ``SMI fields''.
Both ID3 version 1 and version 2 are covered in detail, and mappings
between the fields defined in \cite{SMI} and each ID3 standard are
provided.

\section{ID3v1}

ID3v1 tags must be present in all MPEG 1 Layer III audio files.
Specifically, ID3v1.1 must be used; later versions of the ID3v1
standard may be used as long as compatibility is retained.

\subsection{Field Mappings}

Table~\ref{tab-id3v1-mapping} is a list of ID3v1.1 fields and their
source fields from \cite{SMI}.  In some cases, multiple SMI fields may
be listed for a single ID3v1.1 field to indicate that the combined
content of those SMI fields must be placed into the ID3v1.1 field;
further explanation of such fields follows this section.  Note that
since there is no published standard for ID3v1.1 field names, the
fields' canonical names are used.

\begin{table}[htb]
\caption{ID3v1.1 to SMI Field Mappings}\label{tab-id3v1-mapping}
\medskip
\begin{minipage}{\textwidth}
\begin{center}
\begin{tabular}{|l|l|}
\hline
\textbf{ID3v1.1 Field} & \textbf{SMI Field(s)} \\
\hline
Artist & Artist name, extra artists \\
Album & Set title, set subtitle, collection title, collection subtitle
\\
Song title & Track title, track subtitle, modified subtitle \\
Comment & Continuation of ID3v1.1 ``Song title''\footnote{See
``Song title'' in section~\ref{sec-id3v1-truncating-song-title}.} \\
Year & Release date \\
Genre & Genre \\
\hline
\end{tabular}
\end{center}
\end{minipage}
\end{table}

\subsubsection{Artist}

When adding the SMI extra artists field onto the end of the ID3v1.1
artist field, the content of the extra artists field must be placed in
parentheses within the ID3v1.1 artist field, and a single space must
precede the opening parenthesis.  For example, if the SMI artist name
field contained ``\texttt{Some Artist}'' and the SMI extra artists
field contained ``\texttt{Another Artist}'', the ID3v1.1 artist field
would be ``\texttt{Some Artist (Another Artist)}''.

\subsubsection{Album}

Both the set subtitle and collection subtitle, if any, must each be
surrounded by parentheses.  If this new parenthetical clause follows a
set (non-empty) SMI field, it must be separated from it by a single
space.  If the collection title and/or subtitle are present and follow
the set title and/or subtitle, the collection title/subtitle must be
separated from the set title/subtitle by a single hyphen surrounded by
exactly one space on each side (`` - '').

\subsubsection{Song title}

The track subtitle and modification subtitle, if one or both exist,
must be placed in parentheses and placed after the track title.  The
opening parenthesis must be separated from the track title by exactly
one space.  If both the track subtitle and the modification subtitle
exist, they must be placed in the same set of parentheses and should
be separated from each other by a single hyphen surrounded by exactly
one space on eaach side (`` - '').

\subsection{Truncating fields}
\label{sec-id3v1-truncating}

ID3v1.1 fields are very small relative to the length of most fields
for an average track.  Because of this, when copying information into
ID3v1.1 fields from SMI fields, many fields will have to be truncated.
The following rules must be used to truncate ID3v1.1 fields unless
specifically excepted elsewhere:
\begin{itemize}
\item If multiple SMI fields are listed for an ID3v1.1 field, but the
content of the fields is long enough to force truncation of the
ID3v1.1 field, all SMI fields added to the ID3v1.1 field after the
first SMI field must be included in whole if at all.  In other words,
after the first SMI field has been added, you can only include the
entire content of another SMI field if it will fit in its entirety.
For example, if the SMI field set title fits into the ID3v1.1 album
field, but only part of the SMI set subtitle field will fit, the set
subtitle field cannot be placed into the album title field.
\item For fields where multiple SMI fields are listed for an ID3v1.1
field, the SMI fields must be added in order.  Appending of SMI fields
ends when the first truncation occurs, or when the first SMI field is
omitted.  Skipping fields with data in them to append other fields is
not permitted.  For example, in the above example, after the set
subtitle field was found not to fit and was subsequently dropped,
addition of SMI content to the ID3v1.1 album field ends.
\item If a single SMI field is listed, or if multiple SMI fields are
listed but the first SMI field exceeds the size for the ID3v1.1 field,
the field content must be truncated at the last word boundary (space)
that fits into the ID3v1.1 field.  For example, if the SMI field
artist name contains ``\texttt{Title That Is Too Long For Napster}'',
it should be truncated as ``\texttt{Title That Is Too Long For}'' (not
``\texttt{Title That Is Too Long For Nap}'', which reflects the
maximum size for the ID3v1.1 artist field).
\item If a word boundary is not within the last 33\% of an ID3v1.1
field (about 10 characters in most cases), the field must be truncated
at the maximum field length.  For example, if the SMI set title field
holds
``\texttt{Some\-really\-long\-string\-to\-annoy\-people\-using\-ID3v1}'',
the ID3v1.1 album field must be set to
``\texttt{Some\-really\-long\-string\-to\-annoy\-peo}''.
\end{itemize}

\subsubsection{Song title}
\label{sec-id3v1-truncating-song-title}

The ID3v1.1 comment field is treated as part of the ID3v1.1 song title
field.  To use the comment field, the song title field must be ended
on a word boundary and remaining content put into the comment field.
The normal rules for truncation apply to the combination of these two
fields, not to either individually.  The exception to this is the case
where there is no word boundary in the ID3v1.1 song title field, in
which case the song title must be truncated using normal rules and the
ID3v1.1 comment field cannot be used.

For example, if the SMI track title were ``Some Title Long Enough To
Warrant a Comment That Is Truncated'', the ID3v1.1 song title field
would be ``Some Title Long Enough To'' and the comment field would be
``Warrant a Comment That Is''.

% It's possible that we should allow for people to put, for example,
% just the track title in the song title field and the modification
% subtitle only in the comment field, regardless of whether the
% song title field is "full" or not.

\subsubsection{Year}

The ID3v1.1 field year can only hold four characters.  Thus only the
\texttt{YYYY} (year) field from the SMI release date field is stored
in the ID3v1.1 year field.

\subsection{Coalescing tags}
\label{sec-id3v1-coalescing-tags}

When an SMI field is set but contains only tags, this field is
considered to be a \term{tag-only SMI field}.  When filling an ID3v1.1
field and one or more tag-only SMI fields immediately follow a set
(non-empty) SMI field, the tags from the tag-only SMI fields must be
added as new tags to the first preceeding non-tag-only SMI field.
(See \cite{SMI} for what it means to ``add a tag.'')  After this
merging, the tag-only SMI fields must be considered unset.  This
process is called \term{coalescing tags}.

For example, take a track where the SMI set title is
``\texttt{Exploding Sheep}'', the SMI set subtitle is
``\texttt{[GB]}'', and the SMI collection subtitle is ``\texttt{[CD
1]}''.  Without coalescing tags, the ID3v1.1 album field would be
``\texttt{Exploding Sheep ([GB]) - ([CD 1])}''.  After coalescing
tags, the title becomes ``\texttt{Exploding Sheep [GB; CD1]}''.  Note
that, since the tag-only fields are considered unset, the various
punctuation that was previously added to accomodate them (such as the
parentheses and the hyphen) is removed.

\section{ID3v2}

ID3v2 tags must be present in all MPEG 1 Layer III audio files.
Specifically, ID3v2.4.0 must be used; later versions of the ID3v2
standard may be used as long as compatibility is retained.

\subsection{Field Mappings}

Table~\ref{tab-id3v2-mapping} is a list of ID3v2.4.0 fields and their
source fields from \cite{SMI}.  In some cases, multiple SMI fields may
be listed for a single ID3v2.4.0 field to indicate that the combined
content of those SMI fields must be placed into the ID3v2.4.0 field;
further explanation of such fields follows this section.  The
ID3v2.4.0 field names are taken from \cite{ID3v2NF}.

\begin{table}[htb]
\caption{ID3v2.4.0 to SMI Field Mappings}\label{tab-id3v2-mapping}
\medskip
\begin{minipage}{\textwidth}
\begin{center}
\begin{tabular}{|l|l|}
\hline
\textbf{ID3v2.4.0 Field} & \textbf{SMI Field(s)} \\
\hline
TPE1 & Artist name \\
TPE2 & Extra artists \\
TPE4 & Modifying artists \\
TIPL & Compilation producer \\
TALB & Set title, set subtitle \\
TMED & Media type \\
TDRL & Release date \\
TSST & Collection title, collection subtitle \\
TPOS & Collection position, collection total \\
TCON & Genre \\
TIT2 & Track title \\
TIT3 & Track subtitle, modification subtitle \\
TRCK & Track position, tracks total \\
\hline
\end{tabular}
\end{center}
\end{minipage}
\end{table}

\subsubsection{TIPL}

The ID3v2.4.0 ``involved people'' list is a mapping of names to roles.
The name for the role used must be ``Compilation producer'', with the
name being the value of the SMI field compilation producer.

\subsubsection{TALB and TSST}

The set or collection subtitle, if any, must be surrounded by
parentheses.  If the parenthetical clause follows any other text, the
clause should be preceded by exactly one space.

\subsubsection{TPOS and TRCK}

The collection position or track position must be separated from the
collection total or track total, if any, by a single forward slash
(``\texttt{/}'').

\subsubsection{TIT3}

The track subtitle, if any, must be separated from the modification
subtitle, if any, by a single hyphen surrounded by exactly one space
on each side (``\texttt{ - }'').

\subsection{Truncating fields}

Due to the extremely large sizes afforded to fields by ID3v2.4.0,
there should be no situation in which fields would need to be
truncated.  In the extreme possibility, the same rules for field
truncation as in ID3v1 must be used
(section~\ref{sec-id3v1-truncating}).

\subsection{Coalescing tags}

When filling in ID3v2.4.0 fields from SMI fields, tags must be
coalesced as in section~\ref{sec-id3v1-coalescing-tags}.

\section{Revision history}

\begin{verbatim}
Version 0.1:
- Initial release.

Version 0.2:
- Fixed a grammar/spelling error or two.

Version 0.3:
- Corrected the ID3v2 field mappings for the SMI field genre: was
  TIT1, corrected to TCON.
- Added mapping for compilation producer to TIPL.

Version 0.4:
- Described how the two SMI subtitle fields in the ID3v1.1 song
  title field should be delimited.
- Rewrote some of the general rules for truncating fields.
  Hopefully the meaning is unchanged.
- Removed the last general rule for field truncation, which said
  that parentheses-delimited content could end without the
  closing parenthesis.  This should be impossible, given thte
  first rule that no content after the first field can be added
  unless it fits entirely, and that no first fields are enclosed
  in parentheses.
- Rewrote truncation of song title section somewhat.

Version 0.5:
- Reworded some sections to make formatting requirements more
  clear (for example, when talking about adding space before a
  parenthesis that follows a non-empty field).
- Added section on coalescing tags.
- Fixed bibliography URLs to point to new site.

Version 0.5.1:
- Andy corrected my grammar: parenthesis->parentheses in many
  places.

$Revision: 1.5 $
\end{verbatim}

\begin{thebibliography}{MMM}
\addcontentsline{toc}{section}{References}
\bibitem[SMI]{SMI} ``Standards for Music Information.''  Vers. 0.3.
22 May 2002.  22 May 2002
\texttt{<\selfhref{http://www.codefu.org/tagging/smi/smi.pdf}>}.
\bibitem[ID3v2NF]{ID3v2NF} ``ID3 tag version 2.4.0 - Native Frames.''
1st Nov. 2000.  22 May 2002
\texttt{<\selfhref{http://www.id3.org/id3v2.4.0-frames.txt}>}.
\end{thebibliography}

\end{document}
% vim:set tw=70:
