I've been streamlining my procedure for burning audio CDs, and I like what I've come up with. Unfortunately, I'll never remember it on my own, so here's a note to myself (any whoever else cares) on what to do.

First, build your playlist in MPD, using my one-liner to calculate the playlist duration (my CD-Rs hold 80 minutes). When you've got your playlist arranged to your satisfaction, convert the files to WAVs using:

$ i=1; for x in $(mpc -f '%file%' playlist); do j=$(seq -f '%02g' $i $i); let "i += 1"; flac -d --apply-replaygain-which-is-not-lossless=t -o $j.$(basename ${x/.flac/.wav}) /var/lib/mpd/music/$x; done

This assumes that all the files in your playlist are FLAC files, which is a good idea (disk space is cheap, FLAC is lossless with good open source support). It also assumes you've already stored ReplayGain settings in your FLAC files. If you haven't, you'll get warnings like:

WARNING: can't get track (or even album) ReplayGain tags

If that happens, go back and read about replay gain, add the tags, and try again ;).

See my replay gain post for more details on the --apply-replaygain-which-is-not-lossless option. After the decoding step, you'll have a directory full of WAVs that have been normalized to a standard track-level loudness. The bit about i and j ensures that *.wav will list the tracks in the order in which they appear in your playlist. Then burn the tracks to a CD using cdrecord:

$ cdrecord -v speed=1 dev=/dev/cdrom -eject -dao -audio -pad *.wav

If you don't care about the order, use $(ls *.wav | shuf) instead of *.wav.

That's it! Audio CDs from MPD playlists in two lines.