Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Oct 2009 23:53:49 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Gary Kline <kline@thought.org>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: music file in /tmp/XXX/
Message-ID:  <20091011235349.3ec6d83a.freebsd@edvax.de>
In-Reply-To: <20091011183146.GA1258@thought.org>
References:  <20091011183146.GA1258@thought.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Sun, 11 Oct 2009 11:31:48 -0700, Gary Kline <kline@thought.org> wrote:
> is there a freebsd app that will take my music file, 18 of them in /tmp/XXX,
> all named ogg files, and burn them to a CD?
> [...]
> all are names so i figure they have the internet-title/siong-named
> database tags.  not sure.  i cant figure out howto use k3b to copy these 
> files; i've tried.  is there anything simpler that will burn files from
> /tmp/XXX/ to an audio CD?  I surrender.....  (*****)

Yes there is. So much for the "user-friendlyness" of GUI apps. :-)

I'll attach a simple shell script that has served me well over
the years. I do admit that it seems to be overcomplicated because
of multiple conversions. I've placed the file in my ~/bin and
gave it +x permissions. Use it in the directory you are currently
located at. It requires the presence of the following programs:
ogg123, madplay, sox, as well as burncd, cdrecord or cdrdao for
the burning (and atapicam for the last two).

Just try it, it solves your problem. :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

[-- Attachment #2 --]
#!/bin/sh

echo "=== MP3 + OGG/Vorbis -> Audio CD Converter ==================================="
echo -n "MP3 decoders found:"
DECODER=0
which mpg123 > /dev/null 2>&1
if [ $? -eq 0 ]; then
	DECODER=2
	echo -n " mpg123"
fi
which madplay > /dev/null 2>&1
if [ $? -eq 0 ]; then
	DECODER=1
	echo -n " madplay"
fi
if [ $DECODER -eq 0 ]; then
	echo "none, aborting."
	exit 1
fi
echo -n ", using "
if [ $DECODER -eq 1 ]; then
	echo "madplay."
else
	echo -n "mpg123"
	which madplay > /dev/null 2>&1
	if [ $? -eq 0 ]; then
		echo " and sox."
	else
		echo ", but sox is not available, exiting."
		exit 1
	fi
fi
echo -n "OGG/Vorbis decoders found:"
which ogg123 > /dev/null 2>&1
if [ $? -eq 0 ]; then
	echo " ogg123."
else
	echo "none, aborting."
	exit 1
fi

TOCFILE="audiocd.toc"
echo "CD_DA" > $TOCFILE

FILELIST=`ls *.[mo][pg][3g]`
if [ "$FILELIST" = "" ]; then
	echo "No files (*.mp3 and/or *.ogg) found, aborting."
	exit 1
fi

for FILE in *.[mo][pg][3g]; do
	echo -n "$FILE -> "
	echo $FILE | grep " " > /dev/null 2>&1
	if [ $? -eq 0 ]; then
		echo "filename contains spaces, cannot proceed."
		exit 1
	fi
	TYPE=""
	echo $FILE | grep ".mp3" > /dev/null 2>&1
	if [ $? -eq 0 ]; then
		TYPE="mp3"
	fi
	echo $FILE | grep ".ogg" > /dev/null 2>&1
	if [ $? -eq 0 ]; then
		TYPE="ogg"
	fi
	if [ "$TYPE" = "ogg" ]; then
		ogg123 -q -d raw -f $FILE.raw $FILE
		sox -r 44100 -c 2 -w -s $FILE.raw $FILE.cdr
		rm $FILE.raw
	elif [ "$TYPE" = "mp3" ]; then
		case $DECODER in
		1)
			madplay -q -o cdda:$FILE.cdr $FILE
			;;
		2)
			mpg123 -sq $FILE > $FILE.raw
			sox -r 44100 -c 2 -w -s $FILE.raw $FILE.cdr
			rm $FILE.raw
			;;
		esac
	elif [ "$TYPE" = "" ]; then
		echo "file type unknown, aborting."
		exit 1
	fi
	echo $FILE.cdr
	echo TRACK AUDIO COPY AUDIOFILE \"$FILE.cdr\" 0 >> $TOCFILE
done
echo "Your recording command could be:"
echo " # cdrecord -eject -v -dao -audio *.cdr"
echo " # cdrdao write --eject audiocd.toc"
echo "After finished, don't forget to delete converter garbage:"
echo " # rm *.cdr audiocd.toc"
echo "=============================================================================="
exit 0

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091011235349.3ec6d83a.freebsd>