hi

I am new territory here and not even sure where to start poking around other than the os module some.

Essentially i need to do something like a shell script for batch processing gobs of files. I am trying to use a command line tool (sox, an open source sound file converter that runs from the unix command line) and I don't want to edit the command line, run the job, edit the command line, etc over and over again for hundreds of small files.

I wonder if it is possible to use python to call sox and have it do os.mkdir, process all the input files in a particular directory and put the converted files into the directory it made with mkdir...

so if i had

kp/flute/ST

 kp8/flute/ST/foo01.aif
 kp8/flute/ST/foo02.aif
 kp8/flute/ST/foo03.aif
 kp8/flute/ST/foo04.aif
 kp8/flute/ST/foo05.aif

The script would call sox repeatedly and create a new dir with a converted file for each found in the original folder. like so:

kp/flute/STout/

 kp/flute/STout/foo01.wav
 kp/flute/STout/foo02.wav
 kp/flute/STout/foo03.wav
 kp/flute/STout/foo04.wav
 kp/flute/STout/foo05.wav

what makes this especially hairy is that sox is a monster an typically needs a crazy number of arguments, though these would be the same for the whole batch. A typical command line call i need to make to, say, batch convert files from one sample rate and bit depth to another would look like so:

% sox -V3 -D -S St.01.aif -b16 kp/flute/STout/St.01.wav rate -s -v 44100

Is there away to do this in python, by just pointing it to a whole dir of files and say "do it" to all of these?

cheers,

kevin
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to