Re: [Sndobj-devel] Triggered Wav File playback in Python
Status: Abandoned
Brought to you by:
veplaini
From: Craig L. <lew...@mi...> - 2007-02-06 03:24:38
|
I tried #1 & #3 extensively, as well as tinkering with SndRead() quite a bit. I'm starting to think that in order to accomplish what i want, I need to be able to reset SndWave() to start reading again from the beginning of the file. From the documentation for Class SndIO, it appears that the protected variable m_vecpos holds the value of the current "place reader" in the wav file. Is there any way to access this to reset it? Better yet, is there a way to copy the wav sample into memory and have it triggered? -Craig On 2/5/07, Victor Lazzarini <vic...@nu...> wrote: > 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 > |