From owner-freebsd-questions@FreeBSD.ORG Wed Mar 21 08:43:05 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 08E7C1065674 for ; Wed, 21 Mar 2012 08:43:05 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id BD57B8FC14 for ; Wed, 21 Mar 2012 08:43:04 +0000 (UTC) Received: from r56.edvax.de (port-92-195-185-71.dynamic.qsc.de [92.195.185.71]) by mx01.qsc.de (Postfix) with ESMTP id 608973CCD2; Wed, 21 Mar 2012 09:42:58 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id q2L8gvc9004904; Wed, 21 Mar 2012 09:42:57 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Wed, 21 Mar 2012 09:42:57 +0100 From: Polytropon To: Steve Bertrand Message-Id: <20120321094257.992e4009.freebsd@edvax.de> In-Reply-To: <4F694698.5080009@gmail.com> References: <4F694698.5080009@gmail.com> Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: FreeBSD Mailing List Subject: Re: Convert mp3 to audio CD X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 08:43:05 -0000 On Tue, 20 Mar 2012 23:10:16 -0400, Steve Bertrand wrote: > I know this is a backwards request, as I haven't had to go from mp3 to > audio CD format in at least 10 years, but I do now. > > What is available to do so? This script, ugly as hell, but works. :-) You need to install madplay or mpg123, as well as sox. If you also want to convert Ogg/Vorbis files, you need ogg123 (vorbis-tools). And of course you need a cd burning program such as cdrdao or cdrecord. See the examples for calling them at the end of the script. #!/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 -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...