mkogg.py: Fix 'self.get_mp4_metadata(self, source)'
[blog.git] / posts / Burning_audio_CDs_with_replay_gain.mdwn
1 I've been streamlining my procedure for burning audio CDs, and I like
2 what I've come up with.  Unfortunately, I'll never remember it on my
3 own, so here's a note to myself (any whoever else cares) on what to
4 do.
5
6 First, build your playlist in [[MPD]], using [[my
7 one-liner|MPD_playlist_duration]] to calculate the playlist duration
8 (my CD-Rs hold 80 minutes).  When you've got your playlist arranged to
9 your satisfaction, convert the files to [WAV][]s using:
10
11     $ 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
12
13 This assumes that all the files in your playlist are [FLAC][] files,
14 which is a good idea (disk space is cheap, FLAC is lossless with good
15 open source support).  It also assumes you've already stored
16 ReplayGain settings in your FLAC files.  If you haven't, you'll get
17 warnings like:
18
19     WARNING: can't get track (or even album) ReplayGain tags
20
21 If that happens, go back and read about [[replay gain]], add the tags,
22 and try again ;).
23
24 See my [[replay gain]] post for more details on the
25 `--apply-replaygain-which-is-not-lossless` option.  After the decoding
26 step, you'll have a directory full of WAVs that have been normalized
27 to a standard track-level loudness.  The bit about `i` and `j` ensures
28 that `*.wav` will list the tracks in the order in which they appear in
29 your playlist.  Then burn the tracks to a CD using
30 [[cdrecord|cdrtools]]:
31
32     $ cdrecord -v speed=1 dev=/dev/cdrom -eject -dao -audio -pad *.wav
33
34 If you don't care about the order, use `$(ls *.wav | shuf)` instead of
35 `*.wav`.
36
37 That's it!  Audio CDs from MPD playlists in two lines.
38
39
40 [WAV]: http://en.wikipedia.org/wiki/WAV
41 [FLAC]: http://flac.sourceforge.net/
42
43 [[!tag tags/linux]]
44 [[!tag tags/tools]]