[Sndobj-devel] Triggered Wav File playback in Python
Status: Abandoned
Brought to you by:
veplaini
From: Craig L. <lew...@mi...> - 2007-02-05 21:55:04
|
Anyone have advice on the best route to creating triggered file playback? I'd like to have my program be able to start the playback of a wav file when a flag is set, and then cease playback of that file once the flag is reset. i want this to happen in a thread, though, because there will be other processing (and sounds) taking place (such as a metronome) while the file is playing back. also, the length of playback will vary depending on when the flag is reset (which is controlled by user input) i'm using SndWave, and patching both channels into SndIn objects. everything is then added to a SndThread: ---------------------- wavfile = sndobj.SndWave('C261.wav', 3, 2,16) wavsoundR = sndobj.SndIn(wavfile,1) wavsoundL = sndobj.SndIn(wavfile,2) outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) outp.SetOutput(2, wavsoundR) outp.SetOutput(1, wavsoundL) IT = sndobj.SndThread() IT.AddObj(wavfile,sndobj.SNDIO_IN) IT.AddObj(wavsoundR) IT.AddObj(wavsoundL) IT.AddObj(outp, sndobj.SNDIO_OUT) IT.ProcOn() time.sleep(5) IT.ProcOff() ----------------------------------- I thought about just turning the thread on and off, but when the thread is turned on again after being turned off, it just resumes processing where it left off. is there a way i can get it to resume from the beginnig of the wav file? thanks, craig |