Fun with xargs: parallelized FLAC to MP3 conversion

I’ve been wanting to use xargs for a practical application for some time. I’ve read many articles that have mentioned it, but it was Ted Dziuba’s Taco Bell Programming which was the tipping point.

Here’s the situation: I want to convert my FLAC collection to an MP3 collection so that I can upload my CD collection to Amazon. Further, I’d like to store the MP3s in a different folder, while maintaining the original subfolder structure. Finally, I want to maintain the metadata in my FLAC files; the flac command line utility only seems to support decoding to .wav without metadata.

Finally, I have 8 virtual cores, and I want to use them all to convert everything as quickly as possible.

[…]