13.3 CD Audio

13.3.1 Duplicate Audio CD Using cdrdao

To directly record an audio CD (or a data CD) using one device and employing cdrdao, the simplest command is:

  $ cdrdao copy

See Section 13.2.1 for details of setting up cdrdao.

You’ll be asked to insert a new CD-R (or CD-RW) once the reading is complete and it is ready to write.

If you have both a CD drive (or perhaps a DVD drive) and a CD writer then you can use cdrdao to record direct from the reader to the writer, assuming the appropriate options for the write_device and read_device are recored in the appropriate configuration file (see Section 13.2.1):

  $ cdrdao copy

To do a copy step-by-step, specifying the device and driver explicitly for cdrdao you can do the following:

  $ cdrdao read-cd   --device 0,1,0 --driver generic-mmc audiocd.toc
  $ cdrdao read-cddb --device 0,1,0 --driver generic-mmc audiocd.toc
  $ cdrdao write     --device 0,1,0 --driver generic-mmc audiocd.toc

The read-cddb command will look up the CDDB database on the Internet to find track information for the audio CD and generates a suitable table of contents that will be written to the CD-R if the CD writer supports CD-TEXT.

To just create a table of contents for an audio disk:

  $ cdrdao read-toc --device 0,1,0 --driver generic-mmc audiocd.toc

To add CD-TEXT to the TOC from CDDB (not supported on many CD writers, including the LG)

  $ cdrdao read-cddb --device 0,1,0 --driver generic-mmc audiocd.toc

The cd image is assumed to be in data.wav. Read the image (this command from gcdmaster):

  $ cdrdao read-cd --remote -v0 --read-raw --device 0,1,0 
                   --driver generic-mmc --paranoia-mode 3 
                   --datafile audiocd.bin  audiocd.toc

13.3.2 Duplicate Audio CD Using cdrecord

On Alpine and Festival we can use cdrecord (which fails on Mint) to duplicate an audio CD in Disk At Once mode. The SCSI device for the CD-RW is 1,1,0 on Alpine and 0,0,0 and Festival.

First extract the audio from the source CD into individual WAV files:

  # cdda2wav -v255 -D /dev/hdc -B -Owav

Record the individual WAV files to CD:

  # cdrecord -v speed=8 dev=2,0,0 -dao -useinfo *.wav

Using cdrecord to record Track At Once mode (with a resulting 2 second gap between each track)

  # cdrecord -v speed=4 dev=0,1,0 -pad -audio -dummy *.wav

13.3.3 Audio CD From Collection of MP3s

We can use cdrdao to create an audio CD from a colleciton of mp3 files. On Mint this is the way to do it since cdrecord fails. The only complication is the need for a table of contents file, but it is easy to produce. There are issues to do with gaps but this can safely be ignored. Either wav or cdr files can be written by cdrdao to a CD-R disk.

Put the following into /usr/local/bin/mkcdrtoc:

  #!/bin/sh
  for i in *.mp3; do
    if [ ! -e ${i%mp3}cdr ]; then
      mpg123 --cdr - $i > ${i%mp3}cdr;
    fi
  done
  printf "CD_DA\n" > disk.toc
  for i in *.cdr; do
    printf "TRACK AUDIO\nFILE \"$i\" 0\n" >> disk.toc
  done
  printf "\n========== disk.toc ==================\n"
  cat disk.toc
  printf "========================================\n"
  printf "\n>>>>>>>> Now run \"cdrdao write disk.toc\" <<<<<<<<<<\n"

Then the following two steps will convert all mp3 files in the current directory to cdr, then burn them to a CD-R or CD-RW. If you want to change the order of the tracks, simply edit disk.toc.

  $ mkcdrtoc
  $ cdrdao write disk.toc

We can alternatively use cdrecord:

  $ for i in *.mp3; do mpg123 --cdr - $i > ${i%mp3}cdr; done
  $ cdrecord -v dev=0,1,0 -audio -pad *.cdr


Your donation will support ongoing availability and give you access to the PDF version of the book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.