4
Launch the audio processing in a separated thread and send events.
5
See play_snd.py for subprocess sound player.
8
import subprocess, time, random
10
pipe = subprocess.Popen(["python -i play_snd.py"], shell=True, stdin=subprocess.PIPE).stdin
12
# Wait for the Server to be ready
15
# send events to the sub process
17
snd = "../snds/snd_%d.aif" % random.randrange(1,7)
18
pipe.write("sf.path = '%s'\ndump = sf.play()\n" % snd)
19
time.sleep(random.uniform(.2, .5))
21
# Stop the audio Server before exiting
22
pipe.write("s.stop()\ntime.sleep(0.25)\n")