[Tutor] creating a sound file from a string

Kent Johnson kent37 at tds.net
Tue Jan 20 14:35:11 CET 2009


On Tue, Jan 20, 2009 at 8:12 AM, Norman Khine <norman at khine.net> wrote:
> Is this a safe way to generate random sound files on a web server?
>
>>>> 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

if your webserver allows multiple simultaneous connections, and you
are going to serve merge.wav to a client, make sure you use different
names for each connection so they don't collide.

Kent


More information about the Tutor mailing list