[Tutor] creating a sound file from a string

Kent Johnson kent37 at tds.net
Tue Jan 20 15:11:34 CET 2009

On Tue, Jan 20, 2009 at 9:00 AM, Norman Khine <norman at khine.net> wrote:

>>>>>> from os import popen
>>>>>> merge = popen('sox uppercase-b.wav uppercase-a.wav merge.wav')
>> I'm not sure but you may have to read from merge to allow the process
>> to complete. You might want to use os.system() or one of the
>> subprocess replacements:
>> http://docs.python.org/library/subprocess.html#subprocess-replacements
> How do I check if the process has completed?
> Would I have to explicitly close the file?

I suggest something like
subprocess.call(['sox', 'uppercase-b.wav', 'uppercase-a.wav', 'merge.wav'])
which will wait for the process to complete.

sox is responsible for closing the file.


More information about the Tutor mailing list