MrFreePress Topic Starter
Posts: 3
|
 |
« on: September 13, 2009, 12:13:53 PM » |
|
I feel like a newbie. I've not played with batch files in 20 years. My OS: Windows XP I'm using Windows build of http://www.speex.org/ as my command line. I can successfully, at command promt, one at a time convert file: speexdec 01.spx to 01.wavThe above results in a playable .WAV file that was a .SPX audio file. MY GOAL:In batch file I wish to convert 49 files from .spx to .wav(incrementally named 01.spx to 49.spx) as in the above command line example.I know it is easy to do, with the right knowlege. I've been working on this for 2 hours and cannot locate the right variable/batch process to make this work. Your help is greatly appreciated.
|
|
|
|
« Last Edit: September 13, 2009, 01:34:33 PM by MrFreePress »
|
IP logged
|
|
|
|
billrich Guest
|
 |
« Reply #1 on: September 13, 2009, 12:51:27 PM » |
|
Try a for loop with original file names in a text file:
I could not test the following code. I don't have the speexdec program. I do not have the files placed in the speed.txt file. I don't have the speed.txt file. ( you may post a few lines from the speed.txt file. )
For other options google [ convert spx to wav ]
@ echo off
setLocal EnableDelayedExpansion
cd \
dir /s /b *.spx > speed.txt set /a c=0
for /f "delims==" %%a in (speed.txt) do (
set /a c+=1 speexdec %%a to !c!.wav
)
|
|
|
|
« Last Edit: September 13, 2009, 01:19:34 PM by billrich »
|
IP logged
|
|
|
|
Salmon Trout
Thanked: 546 Posts: 7,952
Computer: Specs Experience: Beginner OS: Unknown
|
 |
« Reply #2 on: September 13, 2009, 01:27:33 PM » |
|
No need for a text file. Convert every .spx file in a folder to a like named wav file: @echo off for /f "delims==" %%F in (*.spx) do speexdec "%%~dpnF.spx" "%%~dpnF.wav"Or some other ideas here: http://www.hydrogenaudio.org/forums/index.php?showtopic=55390
|
Proud to be European
|
|
|
MrFreePress Topic Starter
Posts: 3
|
 |
« Reply #3 on: September 13, 2009, 01:34:11 PM » |
|
Thank you both. Neither seemed to work but it did get me thinking about 'For' statements. After a little more digging I got the following to work successfully. for %%A in (*.spx) do ( speexdec "%%A" %%A.wav ) I don't really understand what each part does but I scrambled long enough to put parts together. 
|
|
|
|
|
|
|
MrFreePress Topic Starter
Posts: 3
|
 |
« Reply #5 on: September 13, 2009, 02:42:23 PM » |
|
You are absolutely right. The resultant file was 01.spx.wav Instead of fixing the syntax i simply pulled out my mass file renamer and renamed to what I needed. I'll make note of your suggestion for next time. Thanks again. 
|
|
|
|
|
billrich Guest
|
 |
« Reply #6 on: September 13, 2009, 03:25:23 PM » |
|
author=Salmon Trout link=topic=91835.msg621187#msg621187 date=1252870053]
Convert every .spx file in a folder to a like named wav file: What if the .spx files are not all in the same folder? What if some .spx files had been placed in another folder on 02/04/2008? It would be nice to find the lost files.
|
|
|
|
|
|
|
billrich Guest
|
 |
« Reply #8 on: September 13, 2009, 03:39:33 PM » |
|
Mr Trout wrote: Let's wait for the OP to ask for the help that he or she actually requires. You may wait if you like. If all the original files did not have sequence numbers in the file name my code adds the squence number. Nice touch.
|
|
|
|
|
|
|
billrich Guest
|
 |
« Reply #10 on: September 13, 2009, 04:01:33 PM » |
|
Please do not call me "Mr Trout" unless you really are intending to start an argument, OK?
Ok, I call you Fishman. You code is very compact and efficient. Very difficult for most of us new people to decipher. But code is for show not for ease to understand or use.
|
|
|
|
|
BatchFileBasics
Thanked: 18 Posts: 387
|
 |
« Reply #11 on: September 13, 2009, 04:22:08 PM » |
|
Ok, I call you Fishman.
You code is very compact and efficient. Very difficult for most of us new people to decipher. But code is for show not for ease to understand or use.
bill you are just being rude and humorless. and weird, i thought code is for use. not the other way around
|
When the power of love overcomes the love of power the world will know peace - Jimi Hendrix. 
|
|
|
|
|
billrich Guest
|
 |
« Reply #13 on: September 14, 2009, 04:55:18 AM » |
|
S.T. wrote: I don't see the point of adding lines that aren't needed, just because some folks find terse code frightening, although I will break code down and explain it step by step if asked, and if I have the time. S.T. is such a nice guy. S.T. not only helps the original poster but all the new readers and students. And S.T. is so humble.
|
|
|
|
|
gh0std0g74
Thanked: 37 Posts: 590
|
 |
« Reply #14 on: September 14, 2009, 05:26:25 AM » |
|
bill you are just being rude and humorless. and weird, i thought code is for use. not the other way around
code is for use AND be maintained. when you maintain code, its best that code is readable and understandable without having to spend 10 minutes finding out what one expression means.
|
|
|
|