Gapless Audio CD Creation from MP3s

From ArchWiki
Revision as of 20:09, 3 September 2009 by Paranoos (talk | contribs) (Create a Table of Contents file)
Jump to: navigation, search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n links end


We'll be using a few programs for this.

pacman -Sy lame cdrdao

Optional: Let's configure cdrdao to use our CD burner. Open up /etc/cdrdao.conf (as root), and enter the /dev entry for your burner in this format:

write_device: "/dev/hdc"

Decode the MP3s

First of all, copy all the songs you want on the CD to a folder. It's best to rename them to reflect the order you want the tracks to be laid out (such as 01.mp3, 02.mp3, etc). Now we're going to decode all the mp3s into uncompressed wav files. Please realize that a full album can take up more than 800MB in wav files alone. This will take some time.

mkdir wav
for file in *.mp3 ; do
   lame --decode "$file" "wav/$file.wav"

Create a Table of Contents file

Once finished, let's make a Table of Contents file that describes the layout of the CD.

cd wav
  echo "CD_DA"
  for file in *.wav ; do
    echo "TRACK AUDIO"
    echo "FILE \"$file\" 0"
} > toc

Optionally, if you would like to insert a 2-second gap between certain tracks, you can edit the toc file and insert this line between the TRACK AUDIO and FILE lines for that track:

PREGAP 00:02:00


Finally, all we have to do is burn the CD.

cdrdao write toc

Some people prefer to burn audio CDs at a low speed for higher quality. Here's an example for burning at 8x:

cdrdao write --speed 8 toc