Re: [Sndobj-devel] Triggered Wav File playback in Python
Status: Abandoned
Brought to you by:
veplaini
From: Victor L. <vic...@nu...> - 2007-02-05 22:11:28
|
Off the top of my head: 1. Using Enable() and Disable() on the SndIn object to switch it on an off. You might get clicks. 2. Using an envelope (eg. Interp + Ring) and trigger the envelope (SetCurve()) on/off. Use Ring to multiply the envelope signal by the SndIn signal. 3. If you delete the Wave reader object from the thread it will also stop reading the file (but SndIn will also need to be disabled) 4. Have a look at the SndRead class. Another alternative is to load the file on a table and read it with an oscillator or with Lookup/i You're right in that ProcOn() and ProcOff() should perhaps just be used at the start/end of synthesis. Victor > > 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 > > ---------------------------------------------------------- > --------------- Using Tomcat but need to do more? Need to > support web services, security? Get stuff done quickly > with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on > Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Sndobj-devel mailing list > Snd...@li... > https://lists.sourceforge.net/lists/listinfo/sndobj-devel |