[Tutor] creating a sound file from a string

Norman Khine norman at khine.net
Tue Jan 20 15:00:09 CET 2009


Kent Johnson wrote:
> 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

How do I check if the process has completed?

Would I have to explicitly close the file?

> 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.
Each merge.wav file will be unique and only for the specific session, 
after which it will be removed from the server.

> Kent

What I am trying to do is a sound captcha, just to learn in putting the 
pieces together.


More information about the Tutor mailing list