1.

Solve : need a batch file to convert multiple sound?

Answer»

I need some help please. I am just learning to make batch files. I am using win xp sp2. I have a bunch of wav files on a cd that I need to convert to u-law. I am using sox to convert them but at this time, I can only convert one at a time. What I need it to do is convert all of them to seperate files.

Here is what I have so far

cd c:\sox12181
sox.exe -V d:\archhangup.wav -r 8000 -c 1 c:\ulfiles\archhangip.ul

This converts one file named archhangup to u-law

sox.exe -V d:\*.wav -r 8000 -c 1 c:\ulfiles\.ul

This converts them all into 1 ulaw file which I don't want.

sox.exe -V d:\*.wav -r 8000 -c 1 c:\ulfiles\*.ul doesn't work

can anyone help?

ThanksNot sure if you have a typo, but this may help:

Code: [Select]cd c:\sox12181
for /f "tokens=1-2 delims=." %%i in ('dir /b *.wav') do (
sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul
)

Your post spells archhangup and archhangip. If this is not a typo another solution would be needed.

8-)no, it didn't work. It was a typo when I was WRITING this. what I want to do as a example

On a CD I have 100 different wav files and I want to convert each of them to u-law. I am using a program named sox to do the conversion. I can convert them one at a time if I enter this command...

c:\sox12181>sox.exe -V d:\test.wav -r 8000 -c 1 c:\ulfiles\test.ul

test.wav - is the name of the wav file that I am converting to u-law

ulfiles - is the name of the directory on my hard drive that I am saving them to

Now what I really want to do is convert them all WITHOUT having to do them one at a time.

Thanks again


Quote

Not sure if you have a typo, but this may help:

Code: [Select]cd c:\sox12181
for /f "tokens=1-2 delims=." %%i in ('dir /b *.wav') do (
sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul
)

Your post spells archhangup and archhangip. If this is not a typo another solution would be needed.

8-)
Please EXPLAIN where or what the error was. I am not familiar with your SOX program but I can find no error in the batch portion of the file.

8-)I open a text editor and copy

cd c:\sox12181
for /f "tokens=1-2 delims=." %%i in ('dir /b *.wav') do (
sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul
)

and make it converter.bat

when I run it, you see a command line blink real fast but there is not output into the directory

If I run c:\sox12181> for /f "tokens=1-2 delims=." %%i in ('dir /b *.wav') do (sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul)

at the command line, I get "%%i was unexpected at this time"

sox can be found here http://sox.sourceforge.net/

I really do thank you for your suggestions.

Quote
Please explain where or what the error was. I am not familiar with your SOX program but I can find no error in the batch portion of the file.

8-)
Yeah, when running a FOR statement at the command line, you only need the single %.

The PROBLEM is with the path or lack of it for the DIR command:

Code: [Select]cd c:\sox12181
for /f "tokens=1-2 delims=." %%i in ('dir /b d:\*.wav') do (
sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul
)

8-)Thank you very much!!! this worked

cd c:\sox12181
for /f "tokens=1-2 delims=." %%i in ('dir /b d:\*.wav') do ( sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul)


Discussion

No Comment Found