Jun 1, 2013

Organizing your music files

This is for Linux

So here's what I use

Delete duplicates:

fdupes -r -d -N .

Delete empty directories:

find -type d -empty | while read line ; do rm -rf "$line" ; done

Clean filenames:

detox -r *

The second thing you should do is try to use Music Brainz or something paid like SongKong or Jaikoz to identify your songs and fix the metadata.

I use Jaikoz and I haven't figured out how to use Jaikoz to organize file names and directories properly.

(this replaces spaces with underscores, which I don't like much, but other than that it's great as it tries to replace non ascii with ascii equivalent.)


If you feel like organizing all those music files on your computer, this article is for you.

I'm gonna assume you have a certain level of tech knowledge.

You need to know only simple stuff. If you already know that filenames have extensions (“.mp3”, “.ogg”) and that Windows hides those extensions from users by default, but that Windows and other operating systems actually need those extensions to know how to open files, then you'll have no problems and I'm sorry to have bothered you here. If not, good luck, you'll probably need it.

I'm going to try to write an article that won't grow old, so even tho I will give examples of software you might want to try for each function, I will always describe the purpose of things, so you can look for yourself for alternatives to the software I'll be using.

The things that you have to worry about are basically the music file itself, the metadata, and the data.

The file is the location of the file (its directory) and the filename.

The medata is all the information about the file. This includes stuff like album, year, genre, but also can include the lyrics and the nice album art picture.

The data is the music data itself. This is the mp3, ogg, wma, flac sound information, and also, the information of how it was encoded (encoder, encoding quality, encoding type, etc)

To fix the filenames means organizing the files themselves, putting them in a nice directory structure so you don't have to dig all around your hard drive, and changing the filenames to something that easily identifies the music within, so you can move the file around without any problems, like having to open it to identify it.

To fix the metadata means fixing what you get to know when you open a sound file in an adequate player. Ideally, with good metadata, even without internet, you get to know mostly everything about the file. It also helps a lot when you are creating mixes in adequate software. To fix this requires adequate software that is capable of identifying a track automatically, or, manual work on your part to identify the tracks from an online repository. This is the information that is used to fix the filenames.

To fix the data. If you are not looking to improve the quality of your tracks, you shouldn't worry about this. But if your song collection has some old files in it, you should give this some attention, as old free encoders were really bad. Files with less than 160kpbs are a big no-no for anyone that listens to a lot of music and can tell the difference. And a lot of people are replacing their collection with lossless FLAC files. Truth be told about this, even tho a FLAC file is lossless, it is lossless in reference to the CD version. And the CD quality is usually not on par with the actual studio recording. That's something to remember. The data is what is used to identify the song, either by you or by adequate software, to get the metadata.

So, if you were paying attention, you will have understood two things.

The first thing is that we don't organize a music collection for the sake of organizing. Organizing is supposed to make the thing more enjoyable and easy to use.
The second thing is that it's a cyclic process, you need the music data to then get the metadata to then create a nice file structure. After you have that you might want to look into the music data again to see if you have any bad quality files. And so it starts over again (although in a smaller scale).

Now that we have the concepts of what we are trying to do, we have to look at our collection.

It's probably a bit organized already.

The first question is. Do you have strong preferences regarding directory and filename structure?

This is tricky. You see, the music download scene has its own naming scheme. Usually it goes like,

artistName\ artistAlbum\ trackNumber. – trackTitle

an example:

Sia\Best of..\10. Bring Night.mp3

See that? I personally don't like that very much. Cause if just copy a few songs from a few albums to make myself a mix, I wont know what I'm looking at. And I won't be able to sort out the files by artist.

So yeah, what I prefer is:

artistName\artistAlbum\artistName trackNumber trackTitle

so it becomes

Sia\Best of...\Sia 10 Bring Night.mp3

Now I can copy that file around, and I'll always know what that file is. Plus, it will still be sorted neatly inside the album directory. It will also be sorted neatly inside a mix directory. Bonus for elegance.

But, what if you already have a directory with a lot of songs by different artists? If you use this organizing method you'll end up with too many album directories with only one song, and artist directories with only one album with only one song. That looks nasty to me.

So, when I only have one song from an artist it goes to the my _misc directory

_misc\artistName trackNumber trackTitle

like so

_misc\Ladytron 06 Blue Jeans

But, if I have a couple songs an album, I'll just keep them in the artist folder, like so

artistName\artistName trackNumber trackTitle
Deftones\Deftones 04 Change

Notice that this way you can have albums directories and music files inside the artist directory.

This is all just a suggestion. What you have when you get an .mp3 directory from the web, is usually good enough. And unless you want to be troubled to mess in settings, organizing software creates a lot of one file folders by default.

Summarizing, the main ideas in organizing music filenames:

- all the songs by the same artist will be in the same place;
- the song file can be moved around and you can know where it belongs in the structure, just by reading the filename;

If you have hundreds of artists in your collection you could organize your artists by genre or decade or whatever, but I advise against it. Just use a Music Library software, like Media Monkey, or good old MusicIP.

So we now have an end result in mind. To get to that we need to correct the metadata. To easily correct the medata the easiest and most error-free way is to use something called audio fingerprinting.

Audio fingeprinting is a process of identifying a track from the sound that it generates. So you can have different encodes of the same track generating the same fingerprint.

This is extremely nice, because this way you can just compare the fingerprints of your tracks to an online library and get all the metadata you need. Thankfully there exists some freeware that does exactly this. MusicBrainz is the most famous. But I still prefer the swiss army knife that is MusicIP.

Just open it, add your songs, wait for it to fingerprint them, and click on the “Fix Tags” button. You can and should go to the preferences to tell it what tags you want to be fixed (usually just pick all of them in their simplified forms).

If you have any troubles, I made a wiki from the MusicIP manual.

The software that does the audio fingerprinting usually has a file renaming / restructuring function that is easy to use. It just changes the filename and directory according to the metadata, to some general structure that you define.

One Very Important Note: There are lots of rare songs that wont be identified, and won't have metadata in them. If you apply this proccess to them, it will change their filename into something empty, and sometimes you will stop knowing anything about the song. I've had this happen to a few asian songs). A solution is to edit metadata yourself. It's always best to have at least basic metadata in all your files.

A note about Unicode. Filenames that have non-english characters in them will present some problems sometimes. For example, this is MusicIP's weakness. It supports unicode, but not in
filenames. My advice is, if you have the option, to romanize when you can.

Software like Jaikoz, although it's not free, has no problem with unicode. Also, Jaikoz is really good, it will get you the lyrics, the album art and whatnot, and the best part about is that it tries to use all of the free services available to accomplish its fingerprinting. It's the best I know of, right now.

Summarizing, to correct metadata you need internet and an audio fingerprinting software. Then you use that fingerprint to retrieve the metadata.

You can use metadata to correct filenames / file structure. When doing this, be careful about non-english characters in your metadata and be very careful about auto-correcting files without any metadata.

If you followed through this until now, you already have the knowledge to get an organized music collection. Congratulations.

Now for the bonus rounds.

Corrupted files and Duplicates.

Corrupted files. Corrupted files are a bit tricky. Software that doesn't support unicode will report files as being corrrupted, so don't trust those. Also, there's plenty of software that does this, but with the negative side of being filetype specific. MusicIP for example, reports as corrupt, songs that are too short. Anyway, the mission is simple, find and delete, and possibly replace with a good version.

Duplicates are easy, just find files with the same fingerprint. Audio fingerprinting software usually has a function such as this. Don't trust software that uses filename/metadata to find duplicates. Another important note, remember to delete the files with the worst quality. A good rule is to delete the one with the least kpbs. Although there is a lot to be said about quality.


Quality is an interesting subject. If you use software like Encspot on your collection you will find which files were created using what encoder. It will also tell you about the relative quality of those files. It's a bit dated and .mp3 oriented, so you might want to look into alternatives.

But it's as simple as this. Better encoding quality, up to a certain quality level, equals better music.

On the other hand remember not to go to extremes, and that sometimes some dofus somewhere will just encode a 92kbps .wma file to FLAC and call it lossless. So be careful.

My advice is if you have a song that you like that is low quality, get a new version. You can use MusicIP or Encspot to find these low quality songs.

Gain and clipping

Gain is how much louder or lower you play a sound. It's like pre-applied volume. Clipping is what happens when you try to ouput a signal higher than what is supported by the system. It just maxes out the ability of the system to produce sound. It's really bad for encoding and it sounds really bad in decoding. There's a few ways to deal with this.

ReplayGain is the best. This just finds out what the volume of the track is, and the necessary gain to avoid clipping. Then it adds that value to the metadata and any player that supports ReplayGain won't clip the song.

The bad side? Most hardware players don't support replaygain :(

So you may consider using something such as Mp3Gain to actually apply the gain directly to the music data.

The main advantages of this process?

- Clipping sounds bad, so this will make your music sound better.
- Your songs will now all have the same volume. You wont need to adjust the volume dial anymore (or use other any auto-volume adjusting features).

Now that we have covered mostly everything, it's time to debate this a bit. If I had to give an advice, I wouldn't recommend this to you. It's much easier to delete what you have and just get a full artist discography from the internet and find out that most of it is already organized and of good quality. But truth be told, not everyone knows this stuff, so even the stuff you get from the web won't be well organized. Plus, if you want the stuff that is rare, you won't be so lucky.

Also it's not very convenient to this to a large unorganized collection.

Now it's fashionable to use streaming services instead of having a collection. If you ask me what I think about them, I think they're great, but they trap you in them, don't forget it.

No comments:

Post a Comment