I'm going to make a bold prediction here, hold on to your hats! I'm going to predict that the next music player I buy will have more storage than the one I have now. I'd bet even the one after that will have more than that one!

While that prediction isn't groundbreaking, thinking about it lead me down an interesting path. I, like probably a lot of people, got onto the bandwagon of ripping my CDs to MP3s pretty early. It was exciting to have my whole collection of music on my hard drive (portable players were pretty rare back then) and compared to my computer speakers the quality was amazing! After doing that, I was then at the point of realizing that I needed to do it again. Things like reliable tagging made it so most of the files weren't useless, but I would get better results by just starting from scratch. So I did.

I then realized that I never want to do this again so I needed to rip all my music into a lossless format, but no player could hold all that data, at least not yet. In turn that forced me to realize that over time storage will probably grow faster than the amount of music I'm interested in, but the variable I can adjust is quality. So I can build a bunch of 96 kbps MP3s for my phone and keep 256 kbps OGGs for my laptop. And, eventually, everyone will just have those flac files I originally ripped. Whew, now getting from A to B.

I decided that I needed to make a Makefile for a few different reasons:

  • Make handles the idea of transformations pretty easily, so the idea of a transformation between flac and another format would be simple to express.
  • Make already tracks which jobs are complete by looking at the file times and which files are created. This would make it easy to rip new CDs as only the new files would be re-encoded.
  • Make can parallelize the whole thing for me to work on my dual-core processor. nice make -j 2
  • If I quit half way make will delete the half built files and allow me to pick up where I left off.
The one problem that I had using Make is that it doesn't easily handle file names with spaces in them. This was easy enough to change:
$ find . -name "*.flac" -exec rename "y/ /_/" {} \;
Which is a small one line operation to find all the files ending in .flac and replace all the spaces in their name with underscores.

Here is the Makefile and the small shell script that I'm using to do the conversion (mostly stolen from a forum thread I can't find now). Everything is grossly hardc oded, but it works great for my situation. My situation includes putting both of these in the Flac folder and wanting to put all the MP3s into the ../mp3 folder. Currently it only builds MP3s at 96 kbps. Good luck, hopefully my collection will be encoded in a couple of days.


posted Dec 31, 2008 | permanent link