Re: Convert mp3 to audio CD

2012-03-21 Thread Polytropon
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 21
if [ $? -eq 0 ]; then
DECODER=2
echo -n  mpg123
fi
which madplay  /dev/null 21
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 21
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 21
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 21
if [ $? -eq 0 ]; then
echo filename contains spaces, cannot proceed.
exit 1
fi
TYPE=
echo $FILE | grep .mp3  /dev/null 21
if [ $? -eq 0 ]; then
TYPE=mp3
fi
echo $FILE | grep .ogg  /dev/null 21
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, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-21 Thread Da Rock

On 03/21/12 13:10, 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?
There is something in ports to do this - don't ask me which, but I 
noticed it in there recently :) It was in the list with k3b and other cd 
burning utils.


Sorry thats all I can remember atm.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-21 Thread Rod Person
On Tue, 20 Mar 2012 23:10:16 -0400
Steve Bertrand steve.bertr...@gmail.com 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?
 

Basically the same as other, but just using lame to convert a directory
full of mp3s


#!/bin/sh

for a in *
do
  OUTF=`echo $a | sed s/\.mp3/.wav/g`
  lame --decode -q 0 $a $OUTF
done



-- 

Rod Person  http://www.rodperson.com  rodper...@rodperson.com

'Silence is a fence around wisdom'
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-21 Thread Polytropon
On Wed, 21 Mar 2012 07:07:40 -0400, Rod Person wrote:
 On Tue, 20 Mar 2012 23:10:16 -0400
 Steve Bertrand steve.bertr...@gmail.com 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?
  
 
 Basically the same as other, but just using lame to convert a directory
 full of mp3s
 
 
 #!/bin/sh
 
 for a in *
 do
   OUTF=`echo $a | sed s/\.mp3/.wav/g`
   lame --decode -q 0 $a $OUTF
 done

Just note that those *.wav files will have to be in the
correct format (44.1 kHz two-channel 16 bit) and maybe
require byte order reversal as well as stripping the
WAV headers to record them as a music CD. It seems that
some recording programs already contain this step. Refer
to audio CD specifications for why pure WAV files don't
make an audio CD.




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-21 Thread Rod Person
On Wed, 21 Mar 2012 12:16:24 +0100
Polytropon free...@edvax.de wrote:

 On Wed, 21 Mar 2012 07:07:40 -0400, Rod Person wrote:
  On Tue, 20 Mar 2012 23:10:16 -0400
  Steve Bertrand steve.bertr...@gmail.com 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?
   
  
  Basically the same as other, but just using lame to convert a
  directory full of mp3s
  
  
  #!/bin/sh
  
  for a in *
  do
OUTF=`echo $a | sed s/\.mp3/.wav/g`
lame --decode -q 0 $a $OUTF
  done
 
 Just note that those *.wav files will have to be in the
 correct format (44.1 kHz two-channel 16 bit) and maybe
 require byte order reversal as well as stripping the
 WAV headers to record them as a music CD. It seems that
 some recording programs already contain this step. Refer
 to audio CD specifications for why pure WAV files don't
 make an audio CD.
 

I've used this for years and never had an issues, but to accomplish
removing the header you would use the -t option along with --decode for
lame and -x does a bit swap, but not sure if that is the same byte order
reversal.





-- 

Rod Person  http://www.rodperson.com  rodper...@rodperson.com

'Silence is a fence around wisdom'
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-21 Thread Polytropon
On Wed, 21 Mar 2012 07:25:11 -0400, Rod Person wrote:
 On Wed, 21 Mar 2012 12:16:24 +0100
 Polytropon free...@edvax.de wrote:
 
  On Wed, 21 Mar 2012 07:07:40 -0400, Rod Person wrote:
   On Tue, 20 Mar 2012 23:10:16 -0400
   Steve Bertrand steve.bertr...@gmail.com 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?

   
   Basically the same as other, but just using lame to convert a
   directory full of mp3s
   
   
   #!/bin/sh
   
   for a in *
   do
 OUTF=`echo $a | sed s/\.mp3/.wav/g`
 lame --decode -q 0 $a $OUTF
   done
  
  Just note that those *.wav files will have to be in the
  correct format (44.1 kHz two-channel 16 bit) and maybe
  require byte order reversal as well as stripping the
  WAV headers to record them as a music CD. It seems that
  some recording programs already contain this step. Refer
  to audio CD specifications for why pure WAV files don't
  make an audio CD.
  
 
 I've used this for years and never had an issues, but to accomplish
 removing the header you would use the -t option along with --decode for
 lame and -x does a bit swap, but not sure if that is the same byte order
 reversal.

Yes, I think that's the correct approach. My old script,
written when I was new to FreeBSD (at v4.0), uses the
unelegant sox -r 44100 -c 2 -w -s $FILE.raw $FILE.cdr
to convert to the proper CD audio format which could
also be used by burncd (deprecated?), but also by cdrdao
and cdrecord with no additional conversion parameters.

Thanks for the hint about lame --decode!



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Convert mp3 to audio CD

2012-03-20 Thread Steve Bertrand
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?

Steve
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-20 Thread Antonio Olivares
On Tue, Mar 20, 2012 at 10:10 PM, Steve Bertrand
steve.bertr...@gmail.com 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?

 Steve

Take a look here:

http://www.linuxquestions.org/questions/linux-software-2/using-mpg123-to-convert-mp3-to-wav-files-332570/

or here

http://www.capuchado.com/articles/ShellMC.html

One that requires mpg123:


=
#!/bin/sh
#
#   mp3_to_wav
#
#   Use to convert mp3's to wav files

echo current directory = `pwd`
echo Please enter working directory -\c
read BASE
if cd $BASE ;
then
{
for i in *.mp3; do
out=$(ls $i | sed -e 's/.mp3//g')
echo $i - $out.wav
mpg321 -w $out.wav $i /dev/null 21
done
}
else
{
echo ERROR!!
exit 1
}
fi

=

or one that uses mplayer:

=

#!/bin/sh
#
# mp3_to_wav
#
echo current directory = `pwd`
echo Please enter working directory -\c
read BASE
if cd $BASE ;
then
{
##
#
# mp3towav
#
# you can comment mplayer line and use faad?  at your own discretion
for i in *.mp3; do
out=$(ls $i | sed -e 's/.mp3//g')
echo In = $i
echo Out = $out.wav
#faad -o $out.wav $i
   mplayer -vc null -vo null -ao pcm:fast $i -ao
pcm:file=${out}.wav #another option
done

}
else
{
echo ERROR!!
exit 1
}
fi
=

Then with the corresponding wav files burn to cd with cdrecord
$ cdrecord -v -dao dev=X,Y, Z driveropts=burnproof -speed=?  -eject -pad *.wav

and you may burn to cd.  Try that out, or you can have graphical tools
to do it, like k3b, select the files and burn to cd.

Regards,



Antonio
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-20 Thread ill...@gmail.com
On 20 March 2012 23:10, Steve Bertrand steve.bertr...@gmail.com 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?


Among probably thousands of other options,
mplayer -vo null -ao pcm:file=outfile.wav infile.mp3
etc etc

-- 
--
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Convert mp3 to audio CD

2012-03-20 Thread Adam Vande More
On Tue, Mar 20, 2012 at 10:10 PM, Steve Bertrand
steve.bertr...@gmail.comwrote:

 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?


multimedia/mp3cd

-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org