oreilly.comSafari Books Online.Conferences.


Creating Audio CDs With Linux
Pages: 1, 2

Stage 3: burning the CD: cdrecord and gcombust

Burning compact discs under Linux is a straightforward matter. Many writable CD drives are supported by current Linux kernels: SCSI drives are directly supported in the SCSI subsystem set up during kernel compilation, and IDE/ATA drives are indirectly supported via the SCSI emulation module (see the Linux CD-Writing HOWTO for a list of supported CD-Rs and CD-RWs). Many mainstream distributions include the SCSI emulation module (ide_scsi.o), but if your distribution doesn't include it, you will need to configure and recompile your kernel for the emulation support.

My CD burner is a Creative Labs RW4224E CD-RW, correctly identified in the kernel boot messages as an IDE/ATAPI drive (/dev/hdc). Figure 5 illustrates how I configured my kernel for SCSI support and Figure 6 shows the SCSI emulation configuration. (The emulation mode depends on some of the SCSI configuration options.) Rather than detail the emulation setup here, I direct the interested reader to Chris Stoddard's CD-Writing with an ATAPI CDR Mini-HOWTO for a step-by-step description of the process. Once the emulation module is installed, the system will recognize the IDE CD-RW as a SCSI device (/dev/scd0).

Jörg Schilling's cdrecord is the indispensable component for burning CDs under Linux. Happily, it is included with every mainstream Linux distribution, and it is very easy to use. Cdrecord can create CD-ROM data discs in standard ISO 9660 format or a hybrid format readable by Macintosh machines, CD-DA (digital audio) discs, and mixed-mode discs that combine ISO 9660 and audio tracks. Typing 'man cdrecord' at a console or xterm command prompt will bring up the very informative manual page, complete with examples and full explanations for every option.

Burning my audio CD from the command line required only this command sequence:

cdrecord -v speed=2 dev=0,0 -audio /home/dlphilp/soundfiles/cd-audio/my_songs/*.wav

Those command options are defined as follows:

  • -v verbosity level (progress display)
  • speed=2 sets the burner to 2x recording speed
  • dev=0,0 uses the device listing as reported by cdrecord -scanbus (a utility to report available CD recording devices)
  • -audio tells cdrecord that the recorded tracks are in CD-DA format (stereo 16-bit 44.1 kHz soundfiles)

It's really that simple, but for those of you who can't bear the thought of working at the Linux console, help is at hand with gcombust (Figure 7), a GTK-based graphic front end for cdrecord. Gcombust organizes cdrecord's many options into a sensible GUI, and if you're using the GNOME desktop, you can drag and drop your files into gcombust's data holding areas.

Note: CD audio is specifically defined as stereo sound sampled at 44.1 kHz with 16-bit resolution. My files were recorded with those specifications, but they were not yet "CD ready." CD audio has its own file format, and WAV files must be converted to that format before burning to disc. Fortunately this process is carried out transparently by cdrecord. Ecasound is also capable of direct conversion, and a number of other format conversion utilities are also available for Linux.

Creating an audio CD may involve some options not used when burning a data disc. For example, by default, audio tracks will be separated by a 2-second gap. This mode is called TAO (tracks at once); if you want your tracks to run together without a gap, or if you want to reset the gap value, you will want to use the DAO (disc at once) mode. Both modes are available from cdrecord; however, for finer control of the DAO mode, you may want to consider using cdrdao, a CD-burning utility specifically designed for disc-at-once recording.

Some words about discs and recording speeds

Blank recordable compact discs are available in a range of formats, capacities, and prices. My experiences with a variety of discs has so far led me to these conclusions:

  1. Don't use cheap discs for important recordings. Spend a little more money for a lot more reliability.
  2. Either 74-minute and 80-minute discs will work fine in standard CD players.
  3. Rewritable audio discs are useful only in your CD-RW drive. They will not work in a regular CD player.

When selecting the speed for burning an audio disc, keep in mind that you increase the likelihood of "coasterizing" it (i.e., making it useful only as a beverage coaster) at the higher rates. My writer is capable of 1x, 2x, and 4x recording speeds, but the 4x is unreliable, creating a condition known as a buffer underrun (the data buffer empties while the laser is still burning the disc). Cdrecord employs BURN-Proof, a technology that enables the safe use of higher burning rates (it suspends and restarts the writing process when the CD recorder's buffer is about to empty); however, not all drives are compatible with the technology (mine is not). It must also be noted that BURN-Proof will only correct buffer underruns; it will not compensate for faulty or inadequate hardware.

For my project I found 1x and 2x to be the safest speeds. Your mileage may vary, but if you are consistently receiving underruns at high burn speeds, try recording at a slower rate (or see if BURN-Proof will work for your drive).

Stage 4: making the cover: cdlabelgen and Kcdlabel

Screenshot of gcombust.

Figure 8. The application gcombust provides a nice GUI for cdlabelgen's options.

No CD project can be called complete until the disc's case has a decorative and descriptive cover. I used B.W. Fitzpatrick's cdlabelgen to prepare the tray and cover labels for my disc. Cdlabelgen must be the simplest label generator available for Linux: It's a small Perl script with only a few options, but it creates perfectly usable covers for data and audio discs. Console-phobic users will be happy to learn that gcombust provides a nice GUI for cdlabelgen's options (Figure 8). Working in X also lets you use the ghostview PostScript file viewer to preview the output before printing.

Here's the command sequence I used to generate the simple cover seen in Figure 9:

cdlabelgen -c "Songs" -s "Dave Phillips" -o

The command options used above indicate the following:

  1. -c category (title)
  2. -s subcategory (subtitle)
  3. -o name for saved PostScript output file
  4. Cdlabelgen works perfectly for quick and easy cover cards, but for a fancier, picturesque cover, I used Pascal Panneels' Kcdlabel (Figure 9). This program is wonderful for the creation of covers with my own images and favorite fonts. When used with the GIMP, Kcdlabel is a powerful tool for making and printing beautiful CD covers (Figure 10).

    CD cover created with Kcdlabel and the Gimp.

    Figure 10. CD cover created with Kcdlabel and the GIMP.

    Stage 5: closing remarks

    On-line Resources:

    The CD Building Project for Unix Jörg Schilling's exhaustive list of CD-creation software

    The CD-Recordable FAQ Andy McFadden's greatly informative page

    GUIs for CD Tools a list of front-ends for cdrecord, mkisofs, cdrdao, and other CD recording utilities

    The Linux CD-Writing HOWTO Winfried Trümper's indispensable guide

    Linux Music & Sound Applications The largest listing on the Internet. See especially the pages on CD software and soundfile editors.

    Hard-copy Resources:

    • Hanson, S. 2000. "Learn To Burn: Mastering Your CDs Under Linux." Maximum Linux 1(4): 39-49.

    • Perlow, J. 2000. "Burn Your Own CDs Now!" Linux Magazine 2(4): 74-79.

    • Pohlmann, K.C., The Compact Disc Handbook, A-R Editions, 1992.

    • Pohlmann, K.C., Principles of Digital Audio, Howard W. Sams & Co., Inc., 1987.

    My friend was quite pleased by both the audio and visual results of my project. I was equally pleased, not only with the appearance and sound of the results, but with the excellent Linux software available for each stage of the project. Ecasound provided dropout-free recording to the hard disk, cdrecord managed the CD burn with no buffer underruns, and cdlabelgen provided a simple way to create tray and cover cards for the completed disc. It's worth pointing out that each stage of my project could be realized either at the Linux console (with ecasound, Gramofile, cdrecord, and cdlabelgen) or in X (with qtecasound, MiXViews, gcombust, and Kcdlabel). It's also worth mentioning that every piece of software used in my project was free and open-source software, and almost all of it is licensed under the GPL. As usual, Linux provides me with an assortment of powerful tools and lets me choose how and where I want to use them. It definitely works for me.

    Dave Phillips maintains the Linux Music & Sound Applications Web site and has been a performing musician for more than 30 years.

    Related articles:

    Coaster-Free Burning with IDE CD Writers

    Broadcast 2000 Brings DV Editing to Linux

    Achieving Low-Latency Response Times Under Linux

    What Is This 3D Audio Business?

    Creating Great Audio for the Web

    Discuss this article in the O'Reilly Network Linux Forum.

    Return to the Linux DevCenter.


Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: