Padding track numbers with zero

wooden letters

The order of tracks within a digital album is dictated by the track number tag. Using this tag, your music player knows how to order the tracks when playing or simply displaying an album. The tag is normally numeric, but some music players treat it as alphabetic when sorting, which means some tracks are displayed out of order.

The track number tag is just one of a number of items which are metadata; metadata informs your music player of the name of the tracks, albums, artists, genres and, pertinent here, the track number. Using this information you can browse your music collection in different ways, such as sorting by track number.

There are two main ways to populate the track number tag. This first is to have a simple integer value denoting the track number of the track within the album, e.g. '5'. The second is to have an integer value and another value denoting the total number of tracks in an album, normally seperated by a forward slash, e.g. '5/12'. It's the first approach we are interested in here, and specifically where our simple integer value is incorrectly treated as a alphabetic character by some naughty music players.

If an album contains at least ten tracks, some tracks will have track numbers that are at least two digits long. The track numbers appear like this:

Track number Track
1 I Wanna Be Adored
2 She Bangs The Drums
...
10 The Is The One
11 I Am The Resurrection

The correct ordering is:

  • 1. I Wanna Be Adored
  • 2. She Bangs The Drums
  • ...
  • 10. This Is The One
  • 11. I Am The Resurrection

But what you sometimes get is:

  • 1. I Wanna Be Adored
  • 10. This Is The One
  • 11. I Am The Resurrection
  • 2. She Bangs The Drums
  • ...

Why? It's because some music players sort track numbers alphabetically rather than numerically. That is, they treat the track number field as a word, when it should be a number. The Sansa Clip+ is an example of a music player that does this.

Amongst less sophisticated music players, such as those embedded into DVD players and the like, the norm is to order tracks by filename, not read the internal tags. Therefore the order is dependent on the alphabetic order of the track file names, which normally begin with the track number. However, because it's a good idea to synchronise your tags and file paths the track number tag and its appearence in the file name should be identical.

What's the solution (other than using a different music player)? The best solution is to zero pad the track numbers. This means, in our example above, the track numbers become:

Track number Track
01 I Wanna Be Adored
02 She Bangs The Drums
...
10 The Is The One
11 I Am The Resurrection

And the result is:

  • 01. I Wanna Be Adored
  • 02. She Bangs The Drums
  • ...
  • 10. This Is The One
  • 11. I Am The Resurrection

By inserting a zero we are playing along with the music player's alphabetic ordering. Because '0' is before '1' in pretty much all character encoding tables used in computers the tracks are correctly ordered.

So how to pad the track numbers with zeros? Three options: use your music player or use a tagger and do it manually or set a rule in bliss so all your music will be assessed at once, and any new music added will be checked too.

Using bliss to pad track numbers

Using bliss is fairly straightforward. We set up our track number formatting rule, apply the rule, then review for uncompliant albums and fix them. Note that track number fixing isn't automatic yet. If you want automatic track number formatting, please suggest it.

Start bliss and open up the settings pull-down. Click Fill in missing information to reveal the Music information settings.

Enable the track number rule

Click the list box next to Track number length at least. This gives four options:

Choose the track number length

Ignore is the default and means bliss does not check track number formats. The next option, Determined by number of tracks in album, means that bliss pads according to the number of tracks in a given album. If the album has less than ten tracks, perhaps in an EP, bliss checks that there is no padding. If there are at least ten tracks and less than one hundred, bliss checks there are two digits and, if not, offers to pad single digits with a zero. Two digits and three digits options are basically 'hardcoded' versions of Determined [...] which do not take into account the length of an album. They are useful if you want a collection-wide rule.

Here, I choose Two digits and click Apply rules. bliss starts assessing albums.

In progress

Once done, any uncompliant albums with bad track number formatting are shown like this:

An album with uncompliant track number formats

Clicking Fix track number formats corrects the padding. You can get a little more detail by hovering over the link:

Click the 'Fix track number formats' fix

After pressing the link, a few seconds later we get:

All done: a compliant album!

So there we have it: compliant track number formats and greater interoperability between all of your music players!

Thanks to Laineys Repertoire for the image above.
tags: tags track number
blog comments powered by Disqus

The Music Library Management blog

Dan Gravell

I'm Dan, the founder and programmer of bliss. I write bliss to solve my own problems with my digital music collection.