Reflections of a CD Burn

February 6th, 2002 by Sean D. Conway in

Creating audio CDs from MP3 files on a Red Hat 7.2 system.
Your rating: None

I have always been impressed with the hosts on home-builder/handyman television shows: they seem to be able to complete whole projects in 30 minutes. Have you tried building an Adirondack chair in 30 minutes?That same project would take me, a measure twice, cut once too short, find more material computer geek, (insert formula) 1h x 30days x 3months = no-chair-yet amount of time. But in 30 minutes, the TV host is usually sitting out in front of the shop with two finished Adirondack chairs, drinking iced tea with his buddy.

This article is the made-for-television, Adirondack chair version of how to burn a CD. What won't be obvious here is the two weeks, Christmas vacation 2001, that I spent off air, researching, testing and editing, to produce both the CDs and the article.

Roll camera

Your buddy wants you to make him audio CDs he can play in his truck. Therefore, you will take MP3 files and burn them to a CD in a format that can be played on the truck CD player or any other one. This project was initiated by my home handyman, jack-of-all-trades, chair-building friend; I'll just call him buddy. Oh yeah, did I mention you want to burn this CD using a PC running Linux.

Requirements

Hardware (What I used)

  • 64MB RAM Pentium 233MMX PC

  • Sony CRX140S (SCSI) CD-ROM burner

  • AVA-1505 AT-to-SCSI Host adapter

Software (What you need)

  • Red Hat Linux 7.2 server installation, with a window manager (GNOME/KDE) GUI support.

Okay, this can be made to work with others Linux distributions or your own from source. I was hoping you would use Red Hat because I have Red Hat stocks in my retirement plan.

  • Cdrtoaster-1.12 application software.

Check out Ian Kjos' Cdrtoaster program at www.jump.net/~brooke/cdrtoast.

Stop Camera

Cdrtoaster is a GUI frontend program that produces syntax critical command-line strings that process the input MP3 file and actually burn the audio CD. The actual CD burning is done by a program called Cdrecord; more on that later. Remember the 30-minute show on building a chair? This is part where all the stuff that needs to be done to make the host's chair look good is now done by you. You need to install Linux on a PC that has all the CD-burning components (i.e., CD/writer) working. Without a working CD burner this article becomes reading room material.

If you do a cat /proc/interrupts at the command line and don't see an interrupt assigned to the SCSI card, go directly to jail, do not pass go and do not collect $200. It took some of that two-week vacation I mentioned before for me to solve this problem on my computer. This is the output after it was working:

[root@burner root]# cat /proc/interrupts
           CPU0
  0:    3770057          XT-PIC  timer
  1:       2317          XT-PIC  keyboard
  2:          0          XT-PIC  cascade
  4:      29089          XT-PIC  serial
  5:      18925          XT-PIC  soundblaster
  8:          1          XT-PIC  rtc
 10:         17          XT-PIC  aha152x <--------Houston we have ignition!
 11:      23053          XT-PIC  eth0
 14:          1          XT-PIC  ide0
 15:     118631          XT-PIC  ide1
NMI:          0
ERR:          0

In order to get the card working in this machine, I did two things.

Thing 1: I edited the /etc/modules.conf file to include alias scsi aha152x. This is the driver required to support this old ISA SCSI card.

Thing 2: I edited the /etc/rc.d/rc.local file to include modprobe scsi aha152x=0x140,10,7,1. This line assigns a port address, interrupts, SCSI IDs and other stuff to the device.

Roll Camera

Confirm your CD-RW is recognized by Cdrecord by entering the following from the command line:

[root@burner root]# cdrecord -scanbus
Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jorg Schilling
Linux sg driver version: 3.1.20
Using libscg version 'schily-0.5'
scsibus0:
        0,0,0     0) *
        0,1,0     1) *
        0,2,0     2) *
        0,3,0     3) *
        0,4,0     4) *
        0,5,0     5) *
        0,6,0     6) 'SONY    ' 'CD-RW  CRX140S  ' '1.0e' Removable CD-ROM <--Houston we have lift off!
        0,7,0     7) *

/usr/bin/cdrecord is the actual program that does the CD buring. Remember Cdrtoaster is the GUI frontend that will speak Cdrecord's syntax-critical language.

Install the Cdrtoaster-1.12 application in your home directory and do a permissions change to make the file executable.

Stop Camera

I put the application in /home/username and did the entered chmod 700 cdrtoaster-1.12 from the command line. The type usermod -G cdwrite username. This second command makes the user a member of the group cdwrite and gives the user sufficient permissions to burn a CD.

Roll Camera

Congratulations you are ready to burn!

Burning

Start the Cdrtoaster application, select the files you wish to burn to a CD, select Audio CD, remove the selection for dummy burn (hey remember, cameras are rolling), insert high quality CD showing label to camera as disk is inserted and select Have a cook off.

Stop camera

If your first audio CD burn sounds like a never before released album of the Chipmunks, welcome to the fan club. Hey didn't you see the part of the show where he told you that how the MP3 are created will effect how the audio sounds after it is processed by Cdrtoaster? Maybe that part landed on the cutting room floor.

Cdrtoaster does two things:Thing 1: MP3 files are converted to WAV format for audio CDs, and this line is taken right from the cdrtoaster-1.12 script.

exec mpg123 -s $orig | sox -t raw -w -s -c 2 -r 44100 - -t wav $tempfile > &/dev/null

If you drop the exec command and replace the variables with filenames, the command can then be executed from the command line. If you manually convert one of your MP3 to a WAV file and test the sound before burning, you may not have to join the fan club.

The industry standard (techie term Red Book) specifies the audio must in be in a format of 44100Hz, 16-bit PCM, 2-channel, big-endian. If the source material for that MP3 was not recorded at 44100Hz, audio errors are created when Cdrtoaster does the conversion to WAV files using mpg123.

The MP3s I was provided were not formatted to the standard. To prevent the creation of Chipmunk albums, I did my own audio conversion from the command line. I then used Cdrtoaster to burn my pretreated files. The following is the command I used:

mpg123 -s sample.mp3 | sox -t raw -w -s -c2 -r 22050 - -t wav -r 44100 sample.wav

Important fact: Linux does not appreciate you filling up certain partitions. WAV files produced from this command may be ten times as large as the original MP3 file. If you run this command from a looping script (execute once to do all the files in a directory at once), Gigs of drive space get eaten up real fast, so make sure you have sufficient drive space to do the conversion.

Thing 2: burn cd.

cdrecord -v -eject dev=/dev/sg0 speed=2 -audio -pad /home/username/sample1.wav

I usually purchase my blank CDs by the "cord" at the local discount store. The novelty of colored CD coasters and computers with no covers has worn off in my household. For this reason I set the burn speed lower and put computer covers back on after working on them. Did I mention my home network has six computers?

You can view the man pages for the command files, like Cdrecord, mpg321(this is not a typing error) and sox if you want to do some research. Note that Cdrtoaster uses mpg123. mpg123 is installed with Red Hat 7.2, but you don't get the valuable man pages. The included man pages are for the GPL-lookalike, but Cdrtoaster scripts can be modified to use the new file. I was staying focused on the goal, buddy with truck that has CD player.

Roll Camera

Back from a commercial, you are sitting in your buddy's truck playing the audio CD you just burned while credits are queuing by. Hey are those two Adirondack chairs I see in the back of that truck. Enjoy.

Sean D. Conway is a former college instructor turned Network System Specialist for a regional telecommunications company in Canada.

__________________________


Special Magazine Offer -- Free Gift with Subscription
Receive a free digital copy of Linux Journal's System Administration Special Edition as well as instant online access to current and past issues. CLICK HERE for offer

Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anonymous's picture

Re: Reflections of a CD Burn ... not clear ...

On February 11th, 2002 Anonymous says:

It's true, I'm having problem creating normal audio files from

mp3 files. It was working with rh-7.1 but, I don't know what I'm doing wrong. I read the article about cdrtoaster, but it's really not clear how it works. I don't know if I added a file or not. The documentation of the cdrtoaster is not complete. And the article doesn't explain my difficulty ! Good look to you.

Anonymous's picture

Re: Reflections of a CD Burn ... looking to clear...

On February 14th, 2002 Anonymous says:

Some conversion problems have to do with how the source is formatted. Entering" file " at the command line will provide some insight into how the file was created. If you know the format of the original, it can provide some insight into the settings needed to convert to a format for an audio CD's.

brianlane's picture

Re: Reflections of a CD Burn

On February 9th, 2002 brianlane (not verified) says:

Has anyone had problems with RH 7.2 and magicdev? I've found that I have to kill off magicdev to prevent it from trying to mount the blank CD. This is when using cdroast gui or cdrecord on the command line.

Brian

Anonymous's picture

Re: Reflections of a CD Burn

On February 6th, 2002 Anonymous says:

One of the things that I have found in using different mp3's with different volume levels is normalize. That way all the tracks are at the same volume levels so you don't have to reach for the volume as the tracks change.

Post new comment

Please note that comments may not appear immediately, so there is no need to repost your comment.
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <i> <b>
  • Lines and paragraphs break automatically.

More information about formatting options

Newsletter

Each week Linux Journal editors will tell you what's hot in the world of Linux. You will receive late breaking news, technical tips and tricks, and links to in-depth stories featured on www.linuxjournal.com.
Sign up for our Email Newsletter

Tech Tip Videos

From the Magazine

December 2009, #188

If last month's Infrastrucuture issue was too "big" for you then try on this month's Embedded issue. Find out how to use Player for programming mobile robots, build a humidity controller for your root cellar, find out how to reduce the boot time of your embedded system, and if you're new to embedded systems find out the basics that go into one. You can also read about the Beagle Board, the Mesh Potato and a spate of other interestingly named items. And along with our regular columns don't miss our new monthly column: Economy Size Geek.


Read this issue