[LAU] audio collage?
Atte André Jensen
atte.jensen at gmail.com
Sat Jan 9 06:24:16 EST 2010
Renato wrote:
> Obviously i forgot to attach the file ;)
I have looked at your script, which unfortunately doesn't work here, I
get "soxi FAIL formats: no handler for file extension `mp3'". Besides
that I have a couple of suggestions or thoughts, you might want to consider:
1) It's good practice to output some kind of help or usage message when
a program is called with no options. Right now I need to look at the
python code to tell what's going on.
2) You should try to avoid wrapping shell commands in os.system calls
whenever possible. Obviously the call to sox need to be that way, but
"touch" (for your need, that is create empty file) can be implemented in
python:
def touch(self, file):
if not os.path.exists(file):
f = open(file,"w")
f.write('')
f.close()
In general you should try to stick to python buildins, including using
tempfile.mktemp() for a tmp file instead of handling it yourself.
3) Although I did this myself, sox is not really nice to wrap in the
first place, since it sometimes changes the names of the arguments and
stuff like that. So your script might not work after the next upgrade of
sox :-(
4) I'm not sure mp3 files are the most obvious file format to work with,
any specific reason you're not working with simple .wav's?
Hope it's ok that I made these suggestions :-)
--
Atte
http://atte.dk http://modlys.dk
More information about the Linux-audio-user
mailing list