Convert .mp3 to .wav

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: JeffreyPynejpyne@worldatwork.org
Date:  
Subject: Convert .mp3 to .wav
I wanted to do the same thing with some MP3's I bought from emusic.com this
weekend, so I made a QAD script that looks like this:

------------------ CUT HERE ------------------------
#!/bin/ksh

INFILE="$1"
OUTFILE=`echo "$INFILE" | sed -e 's/\.mp3/\.wav/'

/usr/bin/mpg123 --buffer 10000 --stdout "$INFILE" | \
/usr/bin/sox -t raw -r 44100 -s -w -c 2 - "$OUTFILE"'
------------------ CUT HERE ------------------------

I just run 'mp32wav Rokken_Tune.mp3' to create Rokken_Tune.wav. And while
you're at it, you could add to the script so that it loops through the
arguments in $@ so that you could convert all the files in a directory.
Like this:

------------------ CUT HERE ------------------------
#!/bin/ksh

while [ "$#" -ne 0 ]
do
    INFILE="$1"
    OUTFILE=`echo "$INFILE" | sed -e 's/\.mp3/\.wav/'


    /usr/bin/mpg123 --buffer 10000 --stdout "$INFILE" | \
    /usr/bin/sox -t raw -r 44100 -s -w -c 2 - "$OUTFILE"'
done
------------------ CUT HERE ------------------------


So if you have Rokken_Tune.mp3, Rawkin_Tune.mp3 and Rockin_Tune.mp3 in your
current directory, you could run 'mp32wav *.mp3' to convert all of them to
.wav files.

BTW, I had never had cause to use mpg123 or sox before this weekend; I found
the syntax for this by doing a Google search for "mp3 wav linux".  The
syntax above may not be 100% correct, but it worked for me (the CD I burned
sounds pretty good, anyway).          


HTH,
Jeff

On Dec 23, 5:59pm, Kevin Buettner wrote:

> On Dec 23, 3:09pm, Rick Rosinski wrote:
>
>> I am looking for a command-line utility that will allow me to convert

.mp3
>> files to .wav files. I tried mpg123 and did not see a wav file option.

I
>> also looked in the CD-Writing HOWTO, and it described how I can create

.cdr
>> files from mpg123. I just want to make .wav files.
>
> Another way to do it is to use mpg123 to produce raw PCM output. Simply
> pipe this into sox with the appropriate options to create a .wav file.