Re: [Sndobj-devel] Mixing objects
Status: Abandoned
Brought to you by:
veplaini
From: Bosko&Toma M. <bos...@gm...> - 2007-08-01 06:56:34
|
Hi Victor! Thanks for your help and example, it helped a lot. Now I run out into another problem with mixing object. Here's example code: import sndobj import time tab = sndobj.HarmTable() env = sndobj.Interp(5000, 0, 4, 2) osc1 = sndobj.Oscili(tab,60,0, None, env) osc2 = sndobj.Oscili(tab,500,0, None, env) osc3 = sndobj.Oscili(tab,1500,0, None, env) mix1 = sndobj.Mixer() mix1.AddObj(osc1) mix1.AddObj(osc2) mix1.AddObj(osc3) out = sndobj.SndRTIO(1) out.SetOutput(1,mix1) t = sndobj.SndThread() t.AddObj(osc1) t.AddObj(osc2) t.AddObj(osc3) t.AddObj(mix1) t.AddObj(env) t.AddObj(out, sndobj.SNDIO_OUT) t.ProcOn() time.sleep(2) mix1.DeleteObj(osc1) time.sleep(2) t.ProcOff() As you can see, after 2 seconds I want to delete osc1 from mixer but this doesn't work as expected: for some reason it deletes osc1 and osc3 from mix1. Also I tried to put print mix1.GetObjNo() after mix1.DeleteObj(osc1) to see is it really only one osc left but it says that ther's still 2 osc left but I can hear only one. Strange thing is that when I tried to delete osc2 or osc3 it's working fine. Only osc1 is problematic. Why? Is it a bug or I'm doing something wrong? Thanks. Bosko On 7/28/07, Victor Lazzarini <vic...@nu...> wrote: > > Something like this: > > mix1 = Mixer() > mix2 = Mixer() > osc1 = Oscili(...) > osc2 = Oscili(...) > echo = Comb(0.5, 0.5, mix1) > > mix1.AddObj(osc1) > mix1.AddObj(osc2) > mix2.AddObj(mix1) > mix2.AddObj(echo) > > t = SndThread() > t.AddObj(osc1) > t.AddObj(osc2) > t.AddObj(mix1) > t.AddObj(echo) > t.AddObj(mix2) > > outp = SndRTIO(mix2) > > t.AddObj(mix2, SNDIO_OUT) > > t.ProcOn() > > etc... > > Victor > > > > > > Hi! > > Thanks for reply. Could you pass some example of how to do > > that? I've been trying for 2 days to do what you've sad > > but with no luck. Thanks. > > > > Bosko > > > > On 7/27/07, Victor Lazzarini <vic...@nu...> > > wrote: > > > > I think the best way of doing this is > > > to use only one SndThread object (not > > > a separate one for each SndObj). Then > > > you can create mixers for each group > > > of SndObjs that you want to mix together > > > and one main mixer that mixes all the > > > separate sub-mixes. > > > > > > Using several threads might not be the > > > most efficient way of doing this, although > > > each thread will end up being mixed with > > > the others (depending on the OS, on Linux > > > this might not happen). > > > > > > Victor > > > > > > > > > > > > > > > Hi! > > > > > > > > Here is the example code: > > > > import sndobj > > > > import time > > > > > > > > class Play(object): > > > > def __init__(self, frq, amp): > > > > self.frq = frq > > > > self.amp = amp > > > > self.tab = sndobj.HarmTable() > > > > self.osc = sndobj.Oscili(self.tab, frq, amp) > > > > self.outp = sndobj.SndRTIO(1) > > > > self.outp.SetOutput(1,self.osc) > > > > self.thread = sndobj.SndThread() > > > > self.thread.AddObj(self.osc) > > > > self.thread.AddObj(self.outp, > > > > sndobj.SNDIO_OUT) def onOff(self,switch): > > > > if switch == 'on': > > > > self.thread.ProcOn() > > > > elif switch == 'off': > > > > self.thread.ProcOff() > > > > > > > > obj1 = Play(100,5000) > > > > obj2 = Play(170,3000) > > > > obj3 = Play(300,2000) > > > > obj1.onOff('on') > > > > obj2.onOff('on') > > > > obj3.onOff('on') > > > > time.sleep(5) > > > > obj1.onOff('off') > > > > obj2.onOff('off') > > > > obj3.onOff('off') > > > > > > > > So it's a simple class and I made 3 object's from it. > > > > How can I mix i.e. just 1st and 3rd object so I can > > > > add some eff just on them? Thanks. > > > > > > > > Bosko > > > > > > > > > > > > > > > > > > ---------------------------------------------------------- > > > > --------------- This SF.net email is sponsored by: > > Splunk Inc. Still grepping through log files to find > > > > problems? Stop. Now Search log events and > > > > configuration files using AJAX and a browser. Download > > > > your FREE copy of Splunk now >> > > > http://get.splunk.com/ > > > > > > > > > _______________________________________________ > > > > Sndobj-devel mailing list > > > > Snd...@li... > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/sndobj-devel > > > > > > > |