Music

I have some music, not an insane amount - but apparently around 16,000 files. This is how I manage that collection.

Requirements

I’m fussy, I like things done a certain way. I can be flexible when I’m asking someone else to solve a problem, but I’m much less flexible when it comes to something I’m handling myself. These are the requirements for each album in my collection, with reasoning is provided below (although ultimately this post is more about the software I use):

  1. Stored in a ${genre}/${album}/${disc}.${track}. ${title}.${ext} structure. ${disc} and ${track} are zero-padded.
  2. The file format should be FLAC.
  3. Album art should be stored as a JPEG, ideally 1400x1400px. Lower is acceptable if I don’t have a copy of the art I can scan. 500x500px is the minimum.
  4. Album art should not be embedded.
  5. For albums with multiple artists, each track should have the ‘Artist’ tag correctly populated to match the person responsible for that single track.
  6. For albums with multiple artists, the ‘Album artist’ tag should either be the principle artist, or if there isn’t one, ‘Various Artists’.
  7. Albums should have a ‘Genre’ tag that matches their enclosing directory.

Why those requirements

The folder structure I use was chosen to best match how I prefer to listen to music. Growing up, I was the sort of kid that would say ‘Oh I listen to everything’ - although back then, it was more to avoid saying “I don’t listen to music, I’m uncool like that”. Although I did have some CD-R’s I’d burnt that contained MIDI from various games. This (I suppose) left me in an odd position in regards to the reminiscence bump. So now I do listen to a wide variety of genres. Although still not dubstep.

Cascading Reminiscence Bumps in Popular Music

This explains the presedence of genre in the tree structure, but perhaps not the rest. Album titles and art are fine triggers for associative memory. As an example, I don’t recall which Hillary Hahn album has that piece by Michiru Oshima - but I do recall it’s the one with Hahn sitting a bit like a Renaissance painting. Similarly, I don’t recall what tracks are on T-SQUARE’s ‘Welcome to the Rose Garden’, nor do I remember the cover. But I know that I like that album. Finally, as for the file name - disc is zero padded for large (typically classical) compilations, with zero-padding to ensure correct ordering when using the terminal. Same for the track number.

Every single piece in my collection is FLAC. Not because I can hear the difference - I can’t. 160kbps Vorbis is enough. But because depending on what I’m playing that music on, I may need to use a proprietary format. Or there may be some support for a newer (and better!) format like Opus.

Album art is important to me. At least as far as album covers go. Many years ago I fought with Google’s Android to have it display album art properly. This was very early days for Android - and as such, in their effort to abstract away the venerable filesystem, they indexed everything and took thumbnails of the album art stored in each ‘folder.jpg’. Of course, when the player (the Xperia Music player in my case) went to fetch the album art, it would pick the thumbnail. Not the best choice in an age where HD screens were the big selling point of these devices.

This I fixed with a convoluted (and terribly performing) bash script that looked at every file in the album art thumbnail cache and ran imagemagick compare against that thumbnail and every full-sized ‘folder.jpg’ in my collection. So O(n2) complexity in the worst case (probably, maths isn’t a strong suit of mine). This had a threshold of around 90% similarity, and the first image to surpass that threshold was chosen. Quicker to write than to run, but it did work.

ImageMagick Compare

Of course, these days I don’t do that. I have a Walkman NW-A55, which has every track stored as 160Kbps Ogg-Vorbis, with embedded 500x500px album art for each track. This lossy library created and copied programatically. Probably something like “for g in *; do for a in *; do for t in *; do mkdir -p /mnt/walkman/MUSIC/${g}/${a}/; ffmpeg -i ${g}/${a}/${t} /mnt/walkman/MUSIC/${g}/${a}/${t}.ogg”. There’s not a lot to go wrong, and honestly, given the size of SD cards, I could just put it all on a 512GB card.

Software

I manage tags with ‘Easytag’. It isn’t the greatest program, but it does work on both Linux and MacOS, and probably Windows too. And it has sufficient effort placed into its bulk-tagging capabilities to keep me using it. I’ve been meaning to try ‘Beets’, which is a more comprehensive library-management tool, with extensibility in its pythonic origins. However I’m skeptical when it comes to bulk-tagging using a third-party metadata source like MusicBrainz, and even moreso when it can also relocate files automatically. But I do intend to try it.

Easytag

Beets

For listening to music on the computer, I prefer to use MusikCube, which has a lovely ncurses-based terminal interface, a solid search mechanism, and the ability to support large libraries (far larger than mine). On top of that, any installation of musikcube can be used to operate any other instance of musikcube (client-server architecture). And that extends to a client application for Android.

Eventually, I intend to knock-up a kiosk interface for musikcube that can attach to a raspberry pi (which I already use, plugged into my home HiFi).

MusikCube

For album art, I primarily use GIMP. Typically to crop, resize, and retouch in that order. Retouching is limited to correcting the contrast of the art to be closer to its intended appearance. If the art on hand is a tremendously high resolution, I will sometimes apply a light gaussian blur to hide moiré prior to cropping and scaling.

GIMP

Finally, some honourable mentions. I referenced it above, but I do make heavy use of the fantastic ffmpeg project for transcoding between formats. I also make use of metaflac for keeping things consistent (and in the case of my walkman, embeddeding the album art). And last, but not least, DragonflyBSD for powering my NAS upon which I store all of these files and run all of these bulk operations.

FFMpeg

Metaflac

DragonflyBSD