On Thu, May 20, 2004 at 10:02:00AM -0400, Jeff Elkins wrote:
> I'm trying to automate this:
> 
> #!/bin/sh
> 
> for i in *; do
>         if test -f $i; then
> 
>     fi
> done
> 
> which works, but gives me: filename.mp3.wav - anyway to end up with 
> filename.wav?

Yes:

mpg123 -s $i | sox -t raw -r 44100 -s -w -c 1 - \
-t wav -r 8000 -w -c 1 "`echo $i | sed -e 's/mp3$/wav/'`"

Some thoughts: Quote all occurences of $i if youre not absolutely sure
that the filenames dont contain any special characters like whitespace etc.
The sox command will only work correctly if the MP3 file has a sample rate
of 44100 Hertz. If this is not the case for all the files you will need
some way to determine the sample rate before the conversion and give sox
the actual input sample rate on the command line. Another possibility is
to decode the MP3 to a temporary WAVE file and use that as the input to
sox so it can determine the sample rate automatically.

Regards
Matthias


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to