The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

Rip audio tracks from CDs

Contributed by: Robert Kellner
This tip is valid for: Both BeOS and Haiku

The following little script will help you if you not only want to grab a few audio tracks but whole CDs in one go:

——–Begin Script————-


cddrive=/dev/disk/ide/atapi/0/slave/0/raw



track=

alltracks=`play $cddrive 0 0 | wc -l` 		#get number of Tracks on CD + one

echo
echo "Number of Tracks on CD is: " `expr $alltracks - 1`
echo
if  [ "$1" = "all" ]		#see if you want to grab whole CD
	then
	track=1		#beginn with Track 1

	echo "Starting to grab the whole CD..."

		while [ $track -lt $alltracks ] 	#continue until all Tracks have been saved

	do
		play $cddrive 7 $track "Track$track"	#Saving Track No n as "Trackn"
		track=`expr $track + 1`
	done
	echo
	echo "All Tracks have been saved to disk."

else
	echo "Grabbing following tracks: $*"

	for each
	do
		play $cddrive 7 $each "Track$each"	#Saving Track No n as "Trackn"
	done
fi

——–End Script————-

However, there is no error handling, so type carefully or implement one yourself. Note also that you may find it easier to simply use Marco Nellisen’s excellent CDDA filesystem driver, which makes CD ripping completely unnecessary under BeOS, since it lets you view the tracks on your CDs as if they were already .WAV files!

You’ll find more information about the shell CD player play in this tip.

Posted in Scripting


(comments are closed).