Copying Audio CD with cdrdao

Special thanks to A Noisebot for writting up this document.

Introduction

The only way (in my opinion) to make exact copies of audio cds in MacOSX is with the unix utility cdrdao. Like the Windows program, EAC, cdrdao creates a kind of disc image of an audio cd. It uses cdparanoia technology to read and re-read the source cd, thereby assuring the most accurate possible capture. For writing, it of course use DAO (disc-at-once).

Cdrdao is a command-line utility: you must be willing to open the Terminal application (in /Applications/Utilities/) and type commands as described in detail below. This is a useful skill for osx in any case - if you haven't learned it already, cdrdao provides an excellent opportunity to do so.

The explanation below is deliberately spelled out in great detail. Don't let this alarm you, it's really not at all hard to copy a cd with cdrdao.

Requirements

To use cdrdao you must have access to an admin account. The reason for this will become clear later. Any version of MacOSX from 10.2 on should be fine, including 10.4. You might need to install Apple's Developer Tools if you haven't already, depending on how you choose to get cdrdao on your Mac. As for hardware, any standard Apple-supplied cd writer should likewise be fine. Third-party writers may introduce some difficulties, depending on the manufacturer.

Getting cdrdao onto your Mac

The easiest way is to install cdrdao with Fink or MacPorts. You can also build it from sources. I'll assume anyone willing to use this approach knows how to do it. The current cdrdao sources do not require any patches to compile in osx. Just unpack the tar, cd to the directory and run ./configure; make; sudo make install.

Preparing to use cdrdao

In order to simplify the use of cdrdao, it's best to make a file called .cdrdao in your home directory. It must have this name exactly, including the initial dot. This is an ordinary text file, the contents of which should be more or less as follows:

read_device: "IODVDServices"
write_device: "IODVDServices"
read_driver: "generic-mmc"
write_driver: "generic-mmc"
write_speed: 2

On some Macs you'll have to change the read_device and write_device to "IOCompactDiscServices". Do this only if your optical does not handle DVDs at all, even for read-only access.

Capturing a disc image and toc from a source cd

In general it's easy to create a disc image with cdrdao: insert the source cd, type in one cdrdao command, wait for it to finish. The result will be the image file itself, and a table of contents or toc which refers to the image and describes the structure of the disc. Once you have this pair of files, creating a copy is a piece of cake: see below.

The cdrdao command to read a cd is as follows:

cdrdao read-cd toc-filename

where toc-filename is the name of the toc file you want it to create. The image file will be called data.bin by default. You can override this is if you like as follows:

cdrdao read-cd --datafile image-filename toc-filename

Of course you should ensure you have enough disk space available for the image, which can be as much as 700MB. The capture process can take quite awhile; be patient.

Although the command above is all that's required in most versions of unix, including Linux, MacOSX introduces a slight complication. As soon as an audio cd is inserted into the drive, the Finder will detect it and mount it as a volume. This makes cdrdao unhappy: it wants full access to the device and does not want the cd to be mounted. You will therefore have to unmount it without ejecting the cd. This is a two step process:

First you need to find out where it's mounted. Do this by running the mount command with no arguments. This will list all mounted volumes. The entry you're looking for will be something like this:

/dev/disk1 on /Volumes/Audio CD (local, nodev, nosuid, read-only)

The exact description will vary, depending on your hardware and whether or not osx can figure out the name of the cd (which would take the place of "Audio CD" above). The important part of this entry is the beginning: /dev/disk1, or whatever it happens to be on your hardware. You'll need this for step 2.

Once you know device, you can unmount as follows:

sudo umount /dev/disk1

where of course /dev/disk1 would be replaced with whatever the device name is on your hardware. Note the command really is umount, with no n after the first u. The use of sudo here means that you must be logged in as an admin user. The sudo will prompt for a password; just type your usual password here.

Manually unmounting a cd in this way will sometimes cause osx to pop up a scary looking dialog box. Ignore it, it's harmless.

Writing a cd-r from a disc image and toc

Given a disc image and toc file as created above, burning a copy is easy:

cdrdao write toc-filename 

When it reports that it's waiting, insert a cd-r blank. Don't insert the blank before this. That's it: just wait for it to burn.

last edited 2008-04-19 02:04:29 by ניר סופר