[Techtalk] Clueless about Ripping & Encoding Audio

Alvin Goats agoats at compuserve.com
Tue Oct 8 23:38:37 EST 2002


First, most mp3 encoders are slow, and mpeg video is even slower (jpeg a
tiff file *AND* mp3 a wav file at the same time...:( 

As such, you *REALLY* want to mp3 encode to a file and then write the
files to a disk for mass storage. bladeenc is an mp3 encoder.

You should also get sox. It has some functions that are very important.
There are some wav files that are not in the proper format for bladeenc
or any other encoder, which can be fixed with sox.

When you rip a CD, you typically make a wav file or in some cases an au
file. bladeenc prefers wav.


Now, the magic sets from my little journal book:

cdda2wav -v255 -D/dev/cdrom -B -Owav

-B rips ALL tracks from the CD to a wav file, -v255 takes care of some
tracks that are mis-mastered on purpose (you have a missing part at the
beginning of a song and the first part of the next song at the end of
the current song). -D/dev/cdrom works for many CD-ROMs that are not
SCSI. -Owav guarantees a wav output. 

cdda2wav -v255 -D2,0 -B -t XX -Owav

-D2,0 is for a SCSI CD at SCSI ID 2 on SCSI card 0. -t XX will rip the
song at track XX.

If you are just duplicating a disk for archival purposes:

cdrecord -v -eject -dao -useinfo dev=2,0 driver=XXXXXXX *.wav

This writes the disk in disk-at-once mode (no 2 second gaps) on the same
SCSI CD with the appropriate driver (my Yamaha CRW-4260 is mmc_cdr, my
Yamaha CDR-100 is yamaha_cdr100, check which driver you need). *.wav
gets all the wav files. This is provided your CD Recorder can do
disk-at-once. If your CD-Recorder can't do disk-at-once, drop the '-dao
-useinfo' section.

If you don't know what your CD-Recorder can do, do this:

cdrecord -v -checkdrive dev=2,0 >mydrive.txt

Then view or print mydrive.txt for a full listing. The following is the
output for my CRW-4260:

Cdrecord 1.8.1 (i686-pc-linux-gnu) Copyright (C) 1995-2000 Jörg
Schilling
TOC Type: 1 = CD-ROM
scsidev: '2,0'
scsibus: 0 target: 2 lun: 0
Using libscg version 'schily-0.1'
atapi: 0
Device type    : Removable CD-ROM
Version        : 2
Response Format: 2
Capabilities   : 
Vendor_info    : 'YAMAHA  '
Identifikation : 'CRW4260         '
Revision       : '1.0q'
Device seems to be: Generic mmc CD-RW.
Using generic SCSI-3/mmc CD-R driver (mmc_cdr).
Driver flags   : SWABAUDIO
Drive buf size : 1176000 = 1148 KB


 

If you are trying to convert to mp3's, then:

bladeenc -QUIT *.wav

bladeenc will convert each *.wav to *.mp3.


If you have mp3's that you want to burn onto a CD, I use mpg123 and sox,
but you can only do one song at a time:

mpg123 -b 10000 -s  filename.mp3 | sox -t raw -r 44100 -s -w -c 2 - 
filename.wav

This does NOT play over the speakers, so it pipes fast to sox and into
the correct wav format for a CD. And it is dash c space 2 space dash
space filename.wav! This is a hard to find, very obscure tidbit!

Some wav files are not in the correct format and need to be converted.
The easiest and most round about way is in sequence:

sox filename.wav filename.cdr
rm filename.wav
sox filname.cdr filname.wav

This reads the any-type wav file and converts it to a raw CD format. You
delete the original wav (best to have a copy someplace else, just in
case :)  Finally, you convert the raw CD format file to a proper 44100
wav file.

This technique works for any sound file sox can handle: 

sox sound.au sound.cdr
sox sound.cdr sound.wav
bladeenc -QUIT *.wav



Lastly, not all wav files have the proper number of bytes, so you may
have to add '-pad' to the cdrecord command line:

cdrecord -v -eject -pad ......

cdrecord will pad or add blanks or zero's to fill out the sector
properly.

Now, IF you have a REALLY fast computer and you set the record speed low
( -speed=1 or -speed=2), then you might be able to pull off the REALLY
complex piping of:

mpg123 -b 10000 -s  filename.mp3 | sox -t raw -r 44100 -s -w -c 2 - 
filename.wav | cdrecord -v -audio -nofix -speed=2 dev=2,0 driver=mmc_cdr
filename.wav

And after you write all the songs you want to the CD, finish with:

cdrecord -v -eject -fix -audio dev2,0 driver=xxxxxx

to fixate or "seal" the disk.


Some fun with sox: I have a turn table that does 33 1/3 and 45 RPM, I
have a record that is 78 RPM. I record the record to tape, encode the
tape to my PC (record, grecord, etc) in a wav file. Now, if I used 45
RPM on a 78 RPM record, I divide 78/45 and get 1.73. So I use sox to
speed things up:

sox -speed 1.733 filename.wav filename.cdr
rm filename.wav
sox filename.cdr filename.wav

and I now have the 78 RPM song!


Now, I won't say how long it took me to acquire all this knowledge ....
but it was a VERY long time!

Take notes, keep a diary or journal with all the bits and pieces you
pick up!

Alvin



More information about the Techtalk mailing list