LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   any smart way to solve this problem? (https://www.linuxquestions.org/questions/linux-general-1/any-smart-way-to-solve-this-problem-18893/)

l_9_l 04-19-2002 12:25 AM

any smart way to solve this problem?
 
Hi Everyone..

I'm looking for smart way to convert *.mp3
to *.wav
provided that the files have the same name,e.g.
linux.mp3 (as an input) linux.wav (as an output)

when I use :
>mpg123 --wav - *.mp3 > *.wav
the outputs will be one file (its name *.wav)

is there any smarter way than
>mpg123 --wav - *.mp3 > 1.wav 2.wav 3.wav etc..

-Note:
*.mp3 = hundreds of files and haven't sorted names like 1.mp3 2.mp3 or a.mp3 or b.mp3..etc

Rex_chaos 04-19-2002 02:01 AM

I don't know the usage of mpg123. However, if I understand the
question completely, the following shell script does help.
#
#
for doc in *.mp3
do
filename=${doc/.mp3/""}
mpg123 --wav - doc > "$filename.wav"
done

l_9_l 04-19-2002 02:44 AM

unfortunately,doesn't work! :(

There's semilar problem too:
I've downloaded many of the slackware packages
through "httrack" which extracted them while the downloading(I didn't use to know that it does so!)

Now,I want to install one of those packages
I get this error message from "installpkg":

Cannot install kift.tgz: package is corrupt (failed 'gzip -l kift.tgz')

I tried to compress them via "gzip" and encouter this error message from "gzip":

gzip: kift.tgz already has .tgz suffix -- unchanged

there're terrible solutions,but I'm looking for the smart and skilled solutions that Linux offers them.

anyway,thanks Rex_chaos

Rex_chaos 04-19-2002 03:00 AM

I wonder if mpg123 is a time-consuming process. If so, try to add 'wait' after mpg123.

I didn't verify it, I hope it works.

l_9_l 04-19-2002 03:20 AM

The same :(
This is the error:

doc: No such file or directory

I run the script in the folder which has the mp3 files.

Rex_chaos 04-19-2002 03:26 AM

I am sorry. I make some mistake. The script should be

#
#
for doc in *.mp3
do
filename=${doc/.mp3/""}
mpg123 --wav - $doc > "$filename.wav"
wait
done

I succeed in transforming *.mp3 into *.wav with the above script

Good luck

l_9_l 04-19-2002 04:54 AM

finally
 
Yes it works properly now..Thanks Rox
I've got another solution too from
Howto-MINI-MP3-CD-Burning:
for i in *.mp3;
do mpg123 -w `basename $i .mp3`.wav $i;
done

All the ways led to ROME


All times are GMT -5. The time now is 03:12 PM.