djcev.com // post


Music File Management 1: Formats, Names, and Tags

Posted by Cameron Vanderzanden on . Tagged freebsd, linux, music, software.

Like most DJs I have a lot of music and a lot of that is files. CD rips, recordings of cassettes and vinyl, flac and mp3 purchases from online record stores, and so on. Articles and conversations about music library organization are always interesting to me, so I thought I'd take a minute here to document how I handle my own collection.

I manage and interact with my digital music library using a computer that runs FreeBSD. Everything is done from the command-line using the Bourne shell, the standard file utilities, some shell scripts, and a few specialized encoders and tagging programs that I'll list next. I don't use Picard or any of the other automated taggers.

File Formats

FLAC is good. I store my own recordings in flac and either purchase flac or other lossless (.wav) that I then convert into flac. I use the reference encoder from xiph.org; I haven't had a single problem with it in 15 years of use. It even comes with its own tagging utility: metaflac(1).

MP3 is bad. When I do have to work with mp3 I use LAME to encode, libmad (with cmus) or mpv to decode, and mid3v2 to handle tags.

I don't keep any other formats in my music library. (Tracker modules are kept in a separate collection).

Directory Structure & File Names

I sort most of my collection by record label. Each label gets its own directory, then within that each release gets a subdirectory. Each release directory name has three key pieces of information: catalog number, artist, and release title. An example:

$ ls "music/By Label/Dominance Electricity"
...
[dr-022.008] trv - technical remote viewing
[dr-023.009] various - global surveyor phase 2
[dr-027.012] imatran voima - commando
...

That's an excerpt of my Dominance Electricity directory. The last entry in that list is catalog number DR-027.012 by artist Imatran Voima titled Commando. Compilations and split releases are given the artist name "various", like Global Surveyor Phase 2 above.

Releases organized by artist are given a directory for the artist then a subdirectory for each release and use the same basic naming convention except that catalog number (in square brackets) is replaced with release year (in parentheses):

$ ls "music/By Artist/Pop Will Eat Itself"
(1990) pop will eat itself - dance of the mad
(1991) pop will eat itself - x y + zee

Files within each release directory look like this:

$ ls "music/By Label/Dominance Electricity/[dr-027.012] imatran voima - commando"
00 back.jpg
00 cover.jpg
00 side a.jpg
00 side b.jpg
a1 imatran voima - commando.flac
a2 imatran voima - commando (bonus beats).flac
b1 imatran voima - commando (sbassship remix).flac
b2 imatran voima - on speed.flac

This is a pretty standard layout of tracknumber then artist followed by tracktitle. For cassette and vinyl releases I usually indicate side then track as shown in the example above. Everything else gets a normal 01-99 tracknumber. Album artwork, press release PDF files, and any other files associated with the release are prefixed with '00'.

This is a common naming scheme, I think. I manually rename all files to follow the above conventions. I chose this layout because it's simple, it displays and sorts correctly from the shell, and it's easy to work with and remember.

Tags

Every flac and mp3 file in my library has at least the following tags:

Display Name id3v2 tag FLAC tag
Artist TPE1 ARTIST
Track Title TIT2 TITLE
Album Title TALB ALBUM
Date TYER or TDRC DATE
Genre TCON GENRE
BPM TBPM BPM
Key TKEY INITIALKEY
Album Artist TPE2 ALBUMARTIST
Track Number TRCK first field TRACKNUMBER
Track Total TRCK 2nd field TRACKTOTAL
Comment COMM COMMENT

In addition to the above tags I store replaygain info in every file. This is done using metaflac's replaygain feature for flac files and mp3gain (through a shell script) for mp3 files. Replaygain is my preferred loudness-normalizing method because it's non-destructive (it's just metadata) and it's built into the tools I'm already using (flac, metaflac).

I use a shell script frontend to metaflac and mid3v2 to edit tags regardless of their filetype; I'll go over that script in the next article in this series. Each tag's content usually comes from either the release packaging or from discogs.com. "Albumartist" is "Various" for compilations and split releases. "Key" is auto-calculated using Mark Hills's key-tools, which itself uses the key detection algorithm developed by Ibrahim Sha'ath for his excellent keyfinder program. "BPM" I tap out for each track with a little tap-tempo program. "Genre" is a bunch of nonsense I make up (just like the various genre tags on this website).

Closing

This is a labored explanation of something pretty simple, but maybe it'll be useful to someone. I figure I'll write two more parts in this series: one about the various shell scripts I use for tagging, and one that'll cover how I have my music player CMUS configured.