Reflections of a CD Burn
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.
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.
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.
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.
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.
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.
Congratulations you are ready to burn!
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.
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.
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.