예제 #1
0
    def __init__(self,agent,voice):
        self.agent = agent
        self.voice = voice

        self.__timestamp = piw.tsd_time()

        atom.Atom.__init__(self,domain=domain.String(),names='voice',ordinal=voice,protocols='remove browse',policy=atom.default_policy(self.set_loop))

        self.looper = loop_native.player(agent.aggregator.get_output(voice),agent.domain,utils.statusify(self.__loop_status))
        agent.clock_cloner.set_output(voice,self.looper.cookie())

        self.loop_off = self.looper.player(0)
        self.loop_on = self.looper.player(1)
        self.loop_toggle = self.looper.player(3)
        self.loop_once = self.looper.player(2)

        self.agent.lights.set_status(self.voice,const.status_inactive)

        self[1] = atom.Atom(domain=domain.BoundedFloat(0.0,100.0,0.0,hints=(T('stageinc',1),T('inc',1),T('biginc',10),T('control','updown')),verbinc=10.0),init=100.0,policy=atom.default_policy(self.set_volume),names='volume')
        self[2] = atom.Atom(domain=domain.BoundedFloat(0.0,100.0,0.0,hints=(T('stageinc',1),T('inc',1),T('biginc',10),T('control','updown')),verbinc=10.0),init=10.0,policy=atom.default_policy(self.set_chop),names='chop')
        self[3] = atom.Atom(domain=domain.Bool(),init=False,names='enable',policy=atom.default_policy(self.set_playing),protocols='set',container=(None,'voice%d'%voice,agent.verb_container()))

        self[3].add_verb2(1,'set([],~a,role(None,[instance(~self)]))', create_action=self.__enable_set, status_action=self.__enable_status)
        self[3].add_verb2(2,'set([un],~a,role(None,[instance(~self)]))', create_action=self.__enable_unset, status_action=self.__enable_status)
        self[3].add_verb2(3,'set([toggle],~a,role(None,[instance(~self)]))', create_action=self.__enable_toggle, status_action=self.__enable_status)

        self.looper.set_chop(10.0)
        self.looper.set_volume(1.0)

        piw.changelist_connect(agent.loop_on,self.loop_on)
        piw.changelist_connect(agent.loop_off,self.loop_off)
        piw.changelist_connect(agent.loop_toggle,self.loop_toggle)

        self.first()
예제 #2
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version,names='clarinet oscillator',ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()

        self[1] = bundles.Output(1,True,names="audio output")

        self.output = bundles.Splitter(self.domain, self[1])
        self.inst = stk_native.clarinet(self.output.cookie(),self.domain)
        self.input = bundles.VectorInput(self.inst.cookie(), self.domain,signals=(1,2,3,4,5,6,7,8,9))

        param=(T('inc',0.02),T('biginc',0.2),T('control','updown'))
        self[2] = atom.Atom()
        self[2][1] = atom.Atom(names='activation input', domain=domain.BoundedFloat(0,1), policy=self.input.merge_policy(1,False))
        self[2][2] = atom.Atom(names='frequency input', domain=domain.BoundedFloat(1,96000), policy=self.input.vector_policy(2,False))
        self[2][3] = atom.Atom(names='pressure input', domain=domain.BoundedFloat(0,1), policy=self.input.merge_policy(3,False))
        
        # TODO: remove
        #self[2][4] = atom.Atom(names='reed stiffness input', domain=domain.BoundedFloat(0,1,hints=param), init=0.5, policy=self.input.merge_policy(4,False))

        self[2][5] = atom.Atom(names='noise gain input', domain=domain.BoundedFloat(0,1,hints=param), init=0.25, policy=self.input.merge_policy(5,False))

        # TODO: remove
        #self[2][6] = atom.Atom(names='vibrato frequency input', domain=domain.BoundedFloat(0,1,hints=param), init=0.2, policy=self.input.merge_policy(6,False), protocols='explicit')
        # TODO: remove
        #self[2][7] = atom.Atom(names='vibrato gain input', domain=domain.BoundedFloat(0,1,hints=param), init=0, policy=self.input.merge_policy(7,False))
        
        self[2][8] = atom.Atom(names='pitch time input', domain=domain.BoundedFloat(0,100000,hints=param), init=10, policy=self.input.merge_policy(8,False))
        self[2][9] = atom.Atom(names='minimum frequency', domain=domain.BoundedFloat(0.1,20,hints=param), init=20, policy=self.input.merge_policy(9,False))
예제 #3
0
    def __init__(self,agent,voice):
        self.agent = agent
        self.voice = voice
        self.__file = None
        self.__fileid = None
        atom.Atom.__init__(self,names='voice',ordinal=voice)

        self.__private = node.Server(value=piw.makenull(0),change=self.__change)
        self.set_private(self.__private)

        self.looper = loop_native.player(agent.aggregator.get_output(voice),agent.domain)
        agent.clock_cloner.set_output(voice,self.looper.cookie())

        self.loop_off = piw.change2(piw.fastchange(self.looper.player(0)),piw.slowchange(utils.changify(self.__off)))
        self.loop_on = piw.change2(piw.fastchange(self.looper.player(1)),piw.slowchange(utils.changify(self.__on)))
        self.loop_toggle = piw.change2(piw.fastchange(self.looper.player(3)),piw.slowchange(utils.changify(self.__toggle)))
        self.loop_once = self.looper.player(2)
        self.__playing = True
        self.agent.lights.set_status(self.voice,const.status_active)

        self[1] = atom.Atom(domain=domain.BoundedFloat(0.0,100.0,0.0,hints=(T('inc',1),T('biginc',10),T('control','updown')),verbinc=10.0),init=100.0,policy=atom.default_policy(self.set_volume),names='volume')
        self[2] = atom.Atom(domain=domain.BoundedFloat(0.0,100.0,0.0,hints=(T('inc',1),T('biginc',10),T('control','updown')),verbinc=10.0),init=10.0,policy=atom.default_policy(self.set_chop),names='chop')

        self.looper.set_chop(10.0)
        self.looper.set_volume(1.0)

        piw.changelist_connect(agent.loop_on,self.loop_on)
        piw.changelist_connect(agent.loop_off,self.loop_off)
        piw.changelist_connect(agent.loop_toggle,self.loop_toggle)
예제 #4
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='envelope',
                             ordinal=ordinal)

        self[2] = atom.Atom()
        self[2][2] = bundles.Output(2, False, names='pressure output')
        self[2][100] = bundles.Output(1, True, names='volume output')

        self.domain = piw.clockdomain_ctl()
        self.output = bundles.Splitter(self.domain, *self[2].values())
        self.adsr = synth_native.adsr(self.output.cookie(), self.domain)
        self.vel = piw.velocitydetect(self.adsr.cookie(), 2, 1)
        self.input = bundles.VectorInput(self.vel.cookie(),
                                         self.domain,
                                         signals=(1, 2, 8, 9, 10, 11),
                                         threshold=5)

        time = (T('inc', 0.01), T('biginc', 0.2), T('control', 'updown'))
        self[1] = atom.Atom()

        self[1][1] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               names='activation input',
                               policy=self.input.merge_policy(1, False))
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               init=0,
                               policy=self.input.vector_policy(2, False),
                               names='pressure input')
        self[1][8] = atom.Atom(domain=domain.BoundedFloat(0, 60, hints=time),
                               init=0.01,
                               names="attack input",
                               policy=self.input.merge_policy(8, False))
        self[1][9] = atom.Atom(domain=domain.BoundedFloat(0, 60, hints=time),
                               init=0.05,
                               names="decay input",
                               policy=self.input.merge_policy(9, False))
        self[1][10] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                                init=0,
                                policy=self.input.merge_policy(
                                    10, policy.IsoStreamPolicy(1, 0, 0)),
                                names='sustain input',
                                fuzzy='++++pressure')
        self[1][11] = atom.Atom(domain=domain.BoundedFloat(0, 60, hints=time),
                                init=0.25,
                                names="release input",
                                policy=self.input.merge_policy(11, False))

        self[3] = atom.Atom(domain=domain.BoundedInt(1, 1000),
                            init=4,
                            names="velocity sample",
                            policy=atom.default_policy(self.__set_samples))
        self[4] = atom.Atom(domain=domain.BoundedFloat(0.1, 10),
                            init=4,
                            names="velocity curve",
                            policy=atom.default_policy(self.__set_curve))
        self[5] = atom.Atom(domain=domain.BoundedFloat(0.1, 10),
                            init=4,
                            names="velocity scale",
                            policy=atom.default_policy(self.__set_scale))
예제 #5
0
    def rpc_dinfo(self,a):
        c=self.get_value()
        l=[]
        if c:
            l.append(('dinfo_id',c))
            l.append(('Current sample',c.split('|')[0]))
            return logic.render_term(T('keyval',tuple(l) ))
        else:
            n=self.get_description()
            l.append(('dinfo_id',n))

            return logic.render_term(T('keyval',tuple(l) ))
예제 #6
0
    def __init__(self, main_agent, chan_num):
        atom.Atom.__init__(self, names='mixer channel', ordinal=chan_num)
        self.main_agent = main_agent
        self.chan_num = chan_num

        self.aggregator = piw.aggregator(
            main_agent.mixer.create_channel(chan_num - 1), main_agent.clk)

        self.control_input = bundles.ScalarInput(self.aggregator.get_output(1),
                                                 main_agent.clk,
                                                 signals=(1, 2))
        self.audio_input = bundles.VectorInput(self.aggregator.get_output(2),
                                               main_agent.clk,
                                               signals=(1, 2))

        self[1] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            init=0,
                            names='left audio input',
                            policy=self.audio_input.vector_policy(1, True),
                            protocols='obm')
        self[2] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            init=0,
                            names='right audio input',
                            policy=self.audio_input.vector_policy(2, True),
                            protocols='obm')

        self[3] = atom.Atom(names='controls')
        self[3][1] = atom.Atom(domain=domain.BoundedFloat(
            -70,
            14,
            hints=(T('stageinc', 0.1), T('inc', 1), T('biginc', 10),
                   T('control', 'updown'), T('distribution', 'tapered'))),
                               init=0,
                               names='volume',
                               policy=self.control_input.notify_policy(
                                   1,
                                   policy.LopassStreamPolicy(1000, 0.97),
                                   notify=main_agent.changes_pending),
                               protocols='bind input')
        self[3][2] = atom.Atom(domain=domain.BoundedFloat(
            -1,
            1,
            hints=(T('stageinc',
                     0.1), T('inc', 0.02), T('biginc',
                                             0.2), T('control', 'updown'))),
                               init=0,
                               names='pan',
                               policy=self.control_input.notify_policy(
                                   2,
                                   policy.LopassStreamPolicy(1000, 0.97),
                                   notify=main_agent.changes_pending),
                               protocols='bind input')

        # fx send controls
        self[4] = FxSendControlsList()
예제 #7
0
    def rpc_dinfo(self, a):
        print 'scale __dinfo:'
        activated = self.__activated_name
        l = []
        if activated is not None:
            print 'scale dinfo', activated
            l.append(('dinfo_id', activated))
            l.append(('Selected scale', self.__describe(activated)))
            l.append(('Definition',
                      ' '.join([str(f) for f in self.__activated_scale])))
            return logic.render_term(T('keyval', tuple(l)))
        else:
            l.append(('dinfo_id', 'scale'))

            return logic.render_term(T('keyval', tuple(l)))
예제 #8
0
    def __init__(self,agent):
        self.__agent = agent
        atom.Atom.__init__(self,names='parameters')

        self[1] = atom.Atom(domain=domain.BoundedInt(1,10000),names='beginning',policy=atom.default_policy(self.__start_change),container=(None,'loopstart',self.__agent.verb_container()),protocols='set')
        self[1].add_verb2(1,'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',create_action=self.__start_create,clock=True)
        self.__agent.model.loopstart_set(piw.make_change_nb(utils.slowchange(self.__start_set)))

        self[2] = atom.Atom(domain=domain.BoundedInt(1,10000),init=16,names='end',policy=atom.default_policy(self.__end_change),container=(None,'loopend',self.__agent.verb_container()),protocols='set')
        self[2].add_verb2(1,'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',create_action=self.__end_create,clock=True)
        self.__agent.model.loopend_set(piw.make_change_nb(utils.slowchange(self.__end_set)))

        self[3] = atom.Atom(domain=domain.BoundedFloat(1,100),init=1,names="step",policy=atom.default_policy(self.__step_change),container=(None,'step',self.__agent.verb_container()),protocols='set')
        self[3].add_verb2(1,'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',create_action=self.__step_create,clock=True)
        self.__agent.model.stepnumerator_set(piw.make_change_nb(utils.slowchange(self.__step_set)))

        self[4] = atom.Atom(domain=domain.BoundedFloat(1,100),init=2,names="fraction",policy=atom.default_policy(self.__fraction_change),container=(None,'fraction',self.__agent.verb_container()),protocols='set')
        self[4].add_verb2(1,'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',create_action=self.__fraction_create,clock=True)
        self.__agent.model.stepdenominator_set(piw.make_change_nb(utils.slowchange(self.__fraction_set)))

        self[5] = atom.Atom(names="position",container=(None,'position',self.__agent.verb_container()),protocols='set')
        self[5].add_verb2(1,'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',create_action=self.__position_create,clock=True)

        self[6] = atom.Atom(domain=domain.BoundedFloat(0.5,20,hints=(T('stageinc',0.1),T('inc',0.1),T('biginc',1),T('control','updown'))),init=0.5,names='doubletap',policy=atom.default_policy(self.__doubletap_change))
        self.__agent.view.doubletap_set(piw.make_change_nb(utils.slowchange(self.__doubletap_set)))
예제 #9
0
    def rpc_dinfo(self,arg):
        l = self.get_dinfo()

        for c in self[5].values():
            l.extend(c.get_dinfo())

        v = logic.render_term(T('keyval',tuple(l)))
        return v
예제 #10
0
    def __init__(self, chan_agent, cookie, name, ordinal_str, fx_chan_num,
                 is_fx_chan):
        self.chan_agent = chan_agent
        self.fx_chan_num = fx_chan_num
        self.__is_fx_chan = is_fx_chan

        if ordinal_str != '':
            ordinal = int(ordinal_str)
        else:
            ordinal = None

        self.label = '%s %s' % (name, ordinal_str)
        atom.Atom.__init__(self, names=name, ordinal=ordinal)

        self.set_property_string('cname', 'effect')
        self.set_property_long('cordinal', fx_chan_num)

        # ------- effect send levels and enables -------
        # enable
        self[1] = atom.Atom(domain=domain.Bool(),
                            init=False,
                            names='enable',
                            policy=atom.default_policy(
                                self.__set_fx_send_enable))
        # send
        self.send_input = bundles.ScalarInput(cookie,
                                              chan_agent.main_agent.clk,
                                              signals=(1, ))
        self[2] = atom.Atom(
            domain=domain.BoundedFloat(0,
                                       120,
                                       hints=(T('inc', 1), T('biginc', 10),
                                              T('control', 'updown'))),
            init=120,
            names='send',
            policy=self.send_input.notify_policy(
                1,
                policy.LopassStreamPolicy(1000, 0.97),
                notify=self.chan_agent.main_agent.volume_changed),
            protocols='bind input')
        self[3] = atom.Atom(domain=domain.Bool(),
                            init=False,
                            names='prefader',
                            policy=atom.default_policy(
                                self.__set_fx_send_prefader))
예제 #11
0
 def __upgradevoiceverb(self,id,vschema):
     vschema2 = list(vschema)
     vctxargs = list(vschema2[3])
     if vctxargs[1]:
         s3 = int(vctxargs[1][0].args[1])
         vctxargs[1] = (T('cnc','%s#5.%d'%(id,s3)),)
         vschema2[3] = tuple(vctxargs)
         vschema = tuple(vschema2)
     return vschema
예제 #12
0
 def __upgradeupdownverb(self,id,vschema,sub,newnum):
     vschema2 = list(vschema)
     vctxargs = list(vschema2[3])
     s3 = int(vctxargs[1][0].args[1])
     vctxargs[1] = (T('cnc','%s#5.%d.%d'%(id,s3,sub)),)
     vschema2[3] = tuple(vctxargs)
     vschema2[1] = newnum
     vschema = tuple(vschema2)
     return vschema
예제 #13
0
    def rpc_dinfo(self,a):
#        path = logic.parse_clause(a)
        current=self.agent.get_current()
        l=[]
        if current is not None:
            l.append(('dinfo_id','current_loop'+str(current)))
            basename = self.agent.loopdb.basename(current)
            l.append(('Name',os.path.splitext(basename)[0]))
            v2=str(self.agent.loopdb.file(current))
            l.append(('File',v2))
            tg = ', '.join(self.agent.loopdb.tags(current))
            l.append(('Tags',tg))
            return logic.render_term(T('keyval',tuple(l) ))
        else:
            n=self.get_description()
            l.append(('dinfo_id',n))

            return logic.render_term(T('keyval',tuple(l) ))
예제 #14
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version,names='panpipe oscillator',ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()

        self[1] = bundles.Output(1,True,names="audio output")

        self.output = bundles.Splitter(self.domain, self[1])
        self.inst = stk_native.panpipe(self.output.cookie(),self.domain)
        self.input = bundles.VectorInput(self.inst.cookie(), self.domain,signals=(2,3,4,5,6,7))

        param=(T('stageinc',0.01),T('inc',0.02),T('biginc',0.2),T('control','updown'))
        self[2] = atom.Atom()
        self[2][2] = atom.Atom(names='frequency input', domain=domain.BoundedFloat(1,96000), policy=self.input.vector_policy(2,filtered_policy()))
        self[2][3] = atom.Atom(names='pressure input', domain=domain.BoundedFloat(0,1), policy=self.input.merge_policy(3,False))
        self[2][4] = atom.Atom(names='reed stiffness input', domain=domain.BoundedFloat(0,1,hints=param), init=0.5, policy=self.input.merge_policy(4,False))
        self[2][5] = atom.Atom(names='noise gain input', domain=domain.BoundedFloat(0,1,hints=param), init=0.2, policy=self.input.merge_policy(5,False))
        self[2][6] = atom.Atom(names='vibrato frequency input', domain=domain.BoundedFloat(0,1,hints=param), init=0.2, policy=self.input.merge_policy(6,False), protocols='explicit')
        self[2][7] = atom.Atom(names='vibrato gain input', domain=domain.BoundedFloat(0,1,hints=param), init=0, policy=self.input.merge_policy(7,False))
예제 #15
0
    def __init__(self, address, ordinal):
        # TODO: change to blownstring, change in SConscript also!
        agent.Agent.__init__(self,
                             signature=version,
                             names='sax oscillator',
                             ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()

        self[1] = bundles.Output(1, True, names="audio output")

        self.output = bundles.Splitter(self.domain, self[1])
        self.inst = stk_native.blownstring(self.output.cookie(), self.domain)
        self.input = bundles.VectorInput(self.inst.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4, 5, 6, 7))

        param = (T('inc', 0.02), T('biginc', 0.2), T('control', 'updown'))
        self[2] = atom.Atom()
        self[2][1] = atom.Atom(names='activation input',
                               domain=domain.BoundedFloat(0, 1),
                               policy=self.input.merge_policy(1, False))
        self[2][2] = atom.Atom(names='freakency input',
                               domain=domain.BoundedFloat(1, 96000),
                               policy=self.input.vector_policy(
                                   2, filtered_policy()))
        self[2][3] = atom.Atom(names='pressure input',
                               domain=domain.BoundedFloat(0, 1),
                               policy=self.input.merge_policy(3, False))
        self[2][4] = atom.Atom(names='reed stiffness input',
                               domain=domain.BoundedFloat(0, 1, hints=param),
                               init=0.5,
                               policy=self.input.merge_policy(4, False))
        self[2][5] = atom.Atom(names='noise gain input',
                               domain=domain.BoundedFloat(0, 1, hints=param),
                               init=0.3,
                               policy=self.input.merge_policy(5, False))
        self[2][6] = atom.Atom(names='blow position input',
                               domain=domain.BoundedFloat(0, 1, hints=param),
                               init=0.45,
                               policy=self.input.merge_policy(6, False))
        self[2][7] = atom.Atom(names='vibrato gain input',
                               domain=domain.BoundedFloat(0, 1, hints=param),
                               init=0,
                               policy=self.input.merge_policy(7, False))
예제 #16
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version,names='cycler',container=10,ordinal=ordinal)

        self.set_private(node.Server())
        self.get_private()[1]=node.Server(change=self.__cycle_set,value=piw.makebool(True,0))
        self.get_private()[2]=node.Server(change=self.__invert_set,value=piw.makebool(False,0))

        self[2] = atom.Atom(names='outputs')
        self[2][2] = bundles.Output(2,False,names='pressure output')
        self[2][3] = bundles.Output(3,False,names='roll output')
        self[2][4] = bundles.Output(4,False,names='yaw output')
        self[2][5] = bundles.Output(5,False,names='scale note output')
        self[2][6] = bundles.Output(6,False,names='frequency output')
        self[2][7] = bundles.Output(16,False,names='damper output')

        self[3] = atom.Atom(names="cycling",domain=domain.Bool(),init=True,policy=atom.default_policy(self.__setcycling))

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))
        self.main_output = bundles.Splitter(self.domain,self[2][2],self[2][3],self[2][4],self[2][5],self[2][6])
        self.damp_output = bundles.Splitter(self.domain,self[2][7])
        self.cycler = piw.cycler(self.domain,32,self.main_output.cookie(),self.damp_output.cookie(),False)
        self.input = bundles.VectorInput(self.cycler.main_cookie(),self.domain,signals=(2,3,4,5,6,16,17),threshold=5)
        self.feedback = bundles.VectorInput(self.cycler.feedback_cookie(),self.domain,signals=(1,),threshold=5)

        self.cycler.set_cycle(True)
        self.cycler.set_maxdamp(1.0)
        self.cycler.set_invert(True)
        self.cycler.set_curve(1.0)

        self[1] = atom.Atom(names='inputs')
        self[1][2]=atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.input.vector_policy(2,False),names='pressure input')
        self[1][3]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.vector_policy(3,False),names='roll input')
        self[1][4]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.vector_policy(4,False),names='yaw input')
        self[1][5]=atom.Atom(domain=domain.BoundedFloat(0,1000),policy=self.input.vector_policy(5,False),names='scale note input')
        self[1][6]=atom.Atom(domain=domain.BoundedFloat(0,96000),policy=self.input.vector_policy(6,False),names='frequency input')
        self[1][7]=atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.feedback.vector_policy(1,False,clocked=False),names='feedback input')
        self[1][8]=atom.Atom(domain=domain.BoundedFloat(0,1),init=0.0,policy=self.input.linger_policy(16,False),names='damper pedal input',container=(None,'damper',self.verb_container()))
        self[1][10]=atom.Atom(domain=domain.BoundedFloat(0,1,hints=(T('stageinc',0.01),T('inc',0.01),T('biginc',0.1),T('control','updown'))),init=1.0,policy=atom.default_policy(self.__setmaxdamp),names='damper maximum input')
        self[1][12]=atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.input.latch_policy(17,False),names='hold pedal input')
        self[1][13]=atom.Atom(domain=domain.BoundedFloat(0.1,10,hints=(T('stageinc',0.1),T('inc',0.1),T('biginc',1),T('control','updown'))),init=1,names="damper curve",policy=atom.default_policy(self.__setdcurve))

        self[4] = atom.Atom(names="inverted damper",domain=domain.Bool(),init=True,policy=atom.default_policy(self.__setinverted))
예제 #17
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version, names='scaler',protocols='bind set',icon='plg_simple/scaler.png',container=5,ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))

        self.__fixed = False
        self.set_private(node.Server(value=piw.makebool(False,0),change=self.__changefix))

        self[1] = atom.Atom()
        self[1][1] = bundles.Output(1,False,names='activation output', protocols='')
        self[1][2] = bundles.Output(2,False,names='pressure output', protocols='')
        self[1][3] = bundles.Output(3,False,names='roll output', protocols='')
        self[1][4] = bundles.Output(4,False,names='yaw output', protocols='')
        self[1][5] = bundles.Output(5,False,names='scale note output', protocols='')
        self[1][6] = bundles.Output(6,False,names='frequency output', protocols='')

        self.ctl = piw.scaler_controller()
        self.ctl_input = bundles.VectorInput(self.ctl.cookie(),self.domain,signals=(1,))

        self.output = bundles.Splitter(self.domain,*self[1].values())
        self.filter = piw.scaler(self.ctl,self.output.cookie(),cubic())
        self.input = bundles.VectorInput(self.filter.cookie(), self.domain,signals=(1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17))
        self.input.correlator.clocksink().add_upstream(self.ctl_input.correlator.clocksink())

        self[4]=atom.Atom()

        self[4][1]=atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.input.merge_policy(1,False),names='activation input')
        self[4][2]=atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.input.vector_policy(2,False),names='pressure input')
        self[4][3]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.merge_policy(3,False),names='roll input')
        self[4][4]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.merge_policy(4,False),names='yaw input')

        th=(T('inc',1),T('biginc',1),T('control','updown'))
        bh=(T('inc',1),T('biginc',1),T('control','updown'))
        sh=(T('choices','[0,2,4,5,7,9,11,12]','[0,1,2,3,4,5,6,7,8,9,10,11,12]','[0,2,4,6,8,10,12]','[0,2,3,5,7,8,10,12]','[0,3,5,6,7,10,12]', '[0,2,3,6,7,8,11,12]','[0,3,5,7,10,12]','[0,2,4,7,9,12]'), T('control','selector'))
        self[4][5]=atom.Atom(domain=domain.BoundedFloat(0,12,hints=th),policy=self.input.merge_policy(5,False),names='tonic input',protocols='bind set',container=(None,'tonic',self.verb_container()))
        self[4][6]=atom.Atom(domain=domain.BoundedFloat(-20,20,hints=bh),policy=self.input.merge_policy(6,False),names='base note input',protocols='bind')


        self[4][7]=atom.Atom(domain=domain.String(hints=sh),init='[0,2,4,5,7,9,11,12]',policy=self.input.merge_policy(7,False),names='scale input',protocols='bind set',container=(None,'scale',self.verb_container()))
        self[4][8]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.merge_policy(9,policy.LopassStreamPolicy(200,0.6)),names='k pitch bend input')
        self[4][9]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.input.merge_policy(10,False),names='global pitch bend input')
        self[4][10]=atom.Atom(domain=domain.BoundedFloat(0,72),init=1,policy=self.input.merge_policy(11,False),names='k bend range input',protocols='bind')
        self[4][11]=atom.Atom(domain=domain.BoundedFloat(0,72),init=12,policy=self.input.merge_policy(12,False),names='global bend range input',protocols='bind')
        self[4][12]=atom.Atom(domain=domain.Aniso(),policy=self.ctl_input.vector_policy(1,False),names='controller input')
        self[4][13]=atom.Atom(domain=domain.Bool(),policy=self.input.merge_policy(14,False),names='override',protocols='bind')
        self[4][14]=atom.Atom(domain=domain.BoundedFloat(-1,9,hints=th),init=3,policy=self.input.merge_policy(15,False),names='octave input',protocols='bind',container=(None,'octave',self.verb_container()))
        self[4][15]=atom.Atom(domain=domain.BoundedInt(1,4),init=2,policy=atom.default_policy(self.__set_curve),names='curve',protocols='bind')
        self[4][16]=atom.Atom(domain=domain.BoundedFloat(0,1000),policy=self.input.merge_nodefault_policy(16,False),names='key input')
        self[4][17]=atom.Atom(domain=domain.BoundedFloat(-10,10,hints=th),init=0,policy=self.input.merge_policy(17,False),names='relative octave input',protocols='bind')

        self.add_verb2(3,'choose([],None,role(none,[ideal([None,scale]),singular]))',callback=self.__tune_scale)
        self.add_verb2(5,'fix([],None)',callback=self.__fix)
        self.add_verb2(6,'fix([un],None)',callback=self.__unfix)

        self[4][5].add_verb2(1,'set([],~a,role(None,[instance(~self)]),role(to,[ideal([None,note]),singular]))',callback=self.__tune_tonic)
        self[4][7].add_verb2(2,'set([],~a,role(None,[instance(~self)]),role(to,[ideal([None,scale]),singular]))',callback=self.__tune_scale)
예제 #18
0
    def get_dinfo_status(self):
        label = self.get_cinfo()
        l = []
        l.append(('dinfo_id', self.get_cinfo()))
        l.append(('channel id', '%d' % self.chan_num))
        l.append(('channel volume', '%d' % self[3][1].get_value()))
        l.append(('channel pan', '%.1f' % self[3][2].get_value()))
        for fx in self[4].values():
            label = self.main_agent.fxchannels[fx.fx_chan_num].get_cinfo()
            l.append((label + ' enable', 'yes' if fx[1].get_value() else 'no'))
            l.append((label + ' send', '%.f' % fx[2].get_value()))

        return logic.render_term(T('keyval', tuple(l)))
예제 #19
0
    def __init__(self, address, ordinal):

        agent.Agent.__init__(self,
                             names='midi clock',
                             signature=version,
                             container=100,
                             ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()

        # the MIDI stream output
        self[1] = bundles.Output(1, False, names="midi output")
        self.output = bundles.Splitter(self.domain, self[1])

        self.midi_clock = midi_native.midi_clock(self.output.cookie(),
                                                 self.domain)

        # the inputs from the metronome
        self.input = bundles.ScalarInput(self.midi_clock.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3))

        self[2] = atom.Atom(names='metronome inputs')
        self[2][1] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(1, False),
                               names='running input')
        self[2][2] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(2, False),
                               names='song beat input')
        self[2][3] = atom.Atom(domain=domain.BoundedFloat(0, 100000),
                               init=120,
                               policy=self.input.policy(3, False),
                               names="tempo input")

        h = (T('inc', 0.5), T('biginc', 10), T('control', 'updown'))
        self[3] = atom.Atom(domain=domain.BoundedFloat(-500, 500, hints=h),
                            init=0,
                            policy=atom.default_policy(self.__set_delay),
                            names="delay")
예제 #20
0
    def __init__(self, channel, fx_chan_num, is_fx_chan):
        self.channel = channel
        self.fx_chan_num = fx_chan_num
        self.__is_fx_chan = is_fx_chan

        atom.Atom.__init__(self, names='effect', ordinal=fx_chan_num)

        cookie = channel.aggregator.get_output(2 + fx_chan_num)

        # ------- effect send levels and enables -------
        # enable
        self[1] = atom.Atom(domain=domain.Bool(),
                            init=False,
                            names='enable',
                            policy=atom.default_policy(
                                self.__set_fx_send_enable))
        # send
        self.send_input = bundles.ScalarInput(cookie,
                                              channel.main_agent.clk,
                                              signals=(1, ))
        self[2] = atom.Atom(
            domain=domain.BoundedFloat(-70,
                                       14,
                                       hints=(T('stageinc', 0.1), T('inc', 1),
                                              T('biginc',
                                                10), T('control', 'updown'),
                                              T('distribution', 'tapered'))),
            init=0,
            names='send',
            policy=self.send_input.notify_policy(
                1,
                policy.LopassStreamPolicy(1000, 0.97),
                notify=self.channel.main_agent.changes_pending),
            protocols='bind input')
        self[3] = atom.Atom(domain=domain.Bool(),
                            init=False,
                            names='prefader',
                            policy=atom.default_policy(
                                self.__set_fx_send_prefader))
예제 #21
0
    def rpc_dinfo(self,a):
        current=self.get_current_id()

        l=[]
        l.append(('dinfo_id',self.get_description()))

        if current is not None:
            basename = self.agent.loopdb.basename(current)
            l.append(('Name',os.path.splitext(basename)[0]))
            v2=str(self.agent.loopdb.file(current))
            l.append(('File',v2))
            tg = ', '.join(self.agent.loopdb.tags(current))
            l.append(('Tags',tg))

        return logic.render_term(T('keyval',tuple(l) ))
예제 #22
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='stereo mixer',
                             protocols='inputlist has_subsys',
                             icon='plg_synth/mixer.png',
                             ordinal=ordinal)

        self.clk = piw.clockdomain_ctl()
        self.vol = piw.make_f2f_table(
            0, 120, 1000, picross.make_f2f_functor(volume_function))
        self.pan = piw.make_f2f_table(-1, 1, 1000,
                                      picross.make_f2f_functor(pan_function))

        self[1] = atom.Atom()
        self[1][1] = bundles.Output(1, True, names='left audio output')
        self[1][2] = bundles.Output(2, True, names='right audio output')

        self.output = bundles.Splitter(self.clk, self[1][1], self[1][2])
        self.final_mixer = piw.stereomixer(self.vol, self.pan, self.clk,
                                           self.output.cookie())
        self.aggregator = piw.aggregator(self.final_mixer.cookie(), self.clk)

        self.ctl_input = bundles.ScalarInput(self.aggregator.get_output(1),
                                             self.clk,
                                             signals=(1, 2))

        self[2] = atom.Atom()
        self[2][1] = atom.Atom(
            domain=domain.BoundedFloat(0,
                                       120,
                                       hints=(T('inc', 1), T('biginc', 10),
                                              T('control', 'updown'))),
            init=100,
            names='master volume',
            policy=self.ctl_input.policy(1,
                                         policy.LopassStreamPolicy(1000,
                                                                   0.97)))
        self[2][2] = atom.Atom(
            domain=domain.BoundedFloat(-1,
                                       1,
                                       hints=(T('inc', 0.02), T('biginc', 0.2),
                                              T('control', 'updown'))),
            init=0,
            names='master pan',
            policy=self.ctl_input.policy(2,
                                         policy.LopassStreamPolicy(1000,
                                                                   0.97)))

        for n in range(0, num_inputs):
            ss = Input(n + 1, self.vol, self.pan, self.clk,
                       self.aggregator.get_output(n + 2), self.signature)
            self.add_subsystem(str(n), ss)
예제 #23
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,signature=version,names='sampler oscillator',container=8,ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()

        self[1] = atom.Atom(names='outputs')
        self[1][1] = bundles.Output(1,True,names="left audio output")
        self[1][10] = bundles.Output(2,True,names="right audio output")
        self[1][3] = bundles.Output(1,False,names="activation output")
        self[1][4] = bundles.Output(2,False,names="delay output")
        self[1][5] = bundles.Output(3,False,names="attack output")
        self[1][6] = bundles.Output(4,False,names="hold output")
        self[1][7] = bundles.Output(5,False,names="decay output")
        self[1][8] = bundles.Output(6,False,names="sustain output")
        self[1][9] = bundles.Output(7,False,names="release output")

        self.audio_output = bundles.Splitter(self.domain, self[1][1], self[1][10])
        self.envelope_output = bundles.Splitter(self.domain, self[1][3], self[1][4], self[1][5], self[1][6], self[1][7], self[1][8], self[1][9])

        self.synth_player = sampler2_native.player(self.audio_output.cookie(),self.domain)
        self.synth_loader = sampler2_native.loader(self.synth_player,self.envelope_output.cookie(),self.domain)
        self.vdetector = piw.velocitydetect(self.synth_loader.cookie(),4,3)

        vel=(T('stageinc',0.1),T('inc',0.1),T('biginc',1),T('control','updown'))
        self[4] = atom.Atom(domain=domain.BoundedInt(1,1000),init=4,names="velocity sample",policy=atom.default_policy(self.__set_samples))
        self[5] = atom.Atom(domain=domain.BoundedFloat(0.1,10,hints=vel),init=4,names="velocity curve",policy=atom.default_policy(self.__set_curve))
        self[7] = atom.Atom(domain=domain.BoundedFloat(0.1,10,hints=vel),init=4,names="velocity scale",policy=atom.default_policy(self.__set_scale))

        self.loader_input = bundles.VectorInput(self.vdetector.cookie(), self.domain, signals=(1,4),threshold=5)
        self.player_input = bundles.VectorInput(self.synth_player.cookie(), self.domain, signals=(1,2,3),threshold=5)

        self[2] = atom.Atom(names='inputs')
        self[2][1]=atom.Atom(domain=domain.BoundedFloat(0,96000,rest=440), names='frequency input',ordinal=1,policy=self.player_input.merge_policy(1,False))
        self[2][2]=atom.Atom(domain=domain.BoundedFloat(-1200,1200,hints=(T('stageinc',1),T('inc',1),T('biginc',10),T('control','updown'))), names='detune input',policy=self.player_input.merge_policy(2,False))
        self[2][3]=atom.Atom(domain=domain.BoundedFloat(0,1), names='activation input',policy=self.player_input.vector_policy(3,False))

        self[2][4]=atom.Atom(domain=domain.BoundedFloat(0,1), names='pressure input',policy=self.loader_input.vector_policy(4,False))
        self[2][5]=atom.Atom(domain=domain.BoundedFloat(-72,72,hints=(T('stageinc',0.5),T('inc',0.5),T('biginc',12),T('control','updown'))), names='transpose', policy=atom.default_policy(self.__settranspose))
        self[2][6]=atom.Atom(domain=domain.BoundedFloat(0,96000,rest=440), names='frequency input',ordinal=2,policy=self.loader_input.merge_policy(1,False))

        self.__transpose = 0
        self[3] = Sample(self)
        self[6] = atom.Atom(domain=domain.Bool(), init=True, names='fade enable', protocols='input explicit', policy=atom.default_policy(self.__set_fade))

        self.add_verb2(1,'first([],None)',self.__first)
        self.add_verb2(2,'next([],None)',self.__next)
        self.add_verb2(3,'name([],None,role(None,[ideal([~server,sample]),singular]),role(to,[abstract]))',self.__name)
        self.add_verb2(4,'choose([],None,role(None,[ideal([~server,sample]),singular]))',self.__choose)
        self.add_verb2(5,'name([un],None,role(None,[ideal([~server,sample]),singular]))',self.__unname)

        self.synth_player.set_fade(True)
예제 #24
0
    def __init__(self, index, vol, pan, clk, cookie, sig):
        agent.Agent.__init__(self,
                             names='mixer channel',
                             ordinal=index,
                             protocols='bind is_subsys notagent',
                             subsystem='channel',
                             signature=version)

        self.channel_mixer = piw.stereomixer(vol, pan, clk, cookie)
        self.aggregator = piw.aggregator(self.channel_mixer.cookie(), clk)

        self.ctl_input = bundles.ScalarInput(self.aggregator.get_output(1),
                                             clk,
                                             signals=(1, 2))
        self.audio_input = bundles.VectorInput(self.aggregator.get_output(2),
                                               clk,
                                               signals=(1, 2))

        self[1] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            init=0,
                            names='left audio input',
                            policy=self.audio_input.vector_policy(1, True),
                            protocols='obm')
        self[2] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            init=0,
                            names='right audio input',
                            policy=self.audio_input.vector_policy(2, True),
                            protocols='obm')
        self[3] = atom.Atom(
            domain=domain.BoundedFloat(0,
                                       120,
                                       hints=(T('inc', 1), T('biginc', 10),
                                              T('control', 'updown'))),
            init=50,
            names='volume',
            policy=self.ctl_input.policy(1,
                                         policy.LopassStreamPolicy(1000,
                                                                   0.97)),
            protocols='bind input')
        self[4] = atom.Atom(
            domain=domain.BoundedFloat(-1,
                                       1,
                                       hints=(T('inc', 0.02), T('biginc', 0.2),
                                              T('control', 'updown'))),
            init=0,
            names='pan',
            policy=self.ctl_input.policy(2,
                                         policy.LopassStreamPolicy(1000,
                                                                   0.97)),
            protocols='bind input')
예제 #25
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version,names='ahdsr',ordinal=ordinal)

        self[2] = atom.Atom(names='outputs')
        self[2][1] = bundles.Output(1,True,names='volume output')
        self[2][2] = bundles.Output(2,False,names='activation output')
        self[2][3] = bundles.Output(8,False,names='pressure output')

        self.domain = piw.clockdomain_ctl()
        self.output = bundles.Splitter(self.domain,self[2][1],self[2][2],self[2][3])
        self.adsr = synth_native.adsr2(self.output.cookie(),self.domain)
        self.vdetect = piw.velocitydetect(self.adsr.cookie(),8,1)

        vel=(T('stageinc',0.1),T('inc',0.1),T('biginc',1),T('control','updown'))
        self[3] = atom.Atom(domain=domain.BoundedInt(1,1000),init=4,names="velocity sample",policy=atom.default_policy(self.__set_samples))
        self[4] = atom.Atom(domain=domain.BoundedFloat(0.1,10,hints=vel),init=4,names="velocity curve",policy=atom.default_policy(self.__set_curve))
        self[5] = atom.Atom(domain=domain.BoundedFloat(0.1,10,hints=vel),init=4,names="velocity scale",policy=atom.default_policy(self.__set_scale))
        self.input = bundles.VectorInput(self.vdetect.cookie(), self.domain,signals=(2,3,4,5,6,7,8,9,10,11,12,13,14),threshold=5)

        time=(T('stageinc',0.01),T('inc',0.01),T('biginc',0.2),T('control','updown'))
        self[1] = atom.Atom(names='inputs')
        self[1][1]=atom.Atom(domain=domain.BoundedFloat(0,1), init=1.0, names="activation input", policy=self.input.merge_policy(13,False), protocols="nostage")
        self[1][2]=atom.Atom(domain=domain.BoundedFloat(0,60,hints=time),init=0, names="delay input", policy=self.input.merge_policy(2,False))
        self[1][3]=atom.Atom(domain=domain.BoundedFloat(0,60,hints=time),init=0.01, names="attack input", policy=self.input.merge_policy(3,False))
        self[1][4]=atom.Atom(domain=domain.BoundedFloat(0,60,hints=time),init=0, names="hold input", policy=self.input.merge_policy(4,False))
        self[1][5]=atom.Atom(domain=domain.BoundedFloat(0,60,hints=time),init=0.05, names="decay input", policy=self.input.merge_policy(5,False))
        self[1][6]=atom.Atom(domain=domain.BoundedFloat(0,1), init=1.0, names="sustain input", policy=self.input.merge_policy(6,False))
        self[1][7]=atom.Atom(domain=domain.BoundedFloat(0,60,hints=time),init=0.5, names="release input", policy=self.input.merge_policy(7,False))
        self[1][8]=atom.Atom(domain=domain.BoundedFloat(0,1), init=0, names="pressure input", ordinal=1, policy=self.input.vector_policy(8,False))
        self[1][9]=atom.Atom(domain=domain.BoundedFloat(0,1), init=0, names="pressure input", ordinal=2, policy=self.input.vector_policy(9,policy.IsoStreamPolicy(1,0,0)))
        self[1][10]=atom.Atom(domain=domain.BoundedFloat(0,1), init=0, names="velocity sensitivity input", policy=self.input.merge_policy(10,False))
        self[1][11]=atom.Atom(domain=domain.BoundedFloat(0,1), init=0, names="aftertouch input", policy=self.input.merge_policy(11,False))
        self[1][12]=atom.Atom(domain=domain.BoundedFloat(0,1), init=0, names="pedal input", policy=self.input.latch_policy(12,False))
        self[1][13]=atom.Atom(domain=domain.BoundedFloat(0,1), init=0.5, names="damper input", policy=self.input.linger_policy(14,False))

        self.__set_samples(4)
        self.__set_curve(4)
        self.__set_scale(4)
예제 #26
0
    def rpc_dinfo(self, arg):
        l = []
        dsc = self.get_description()
        l.append(('dinfo_id', dsc))
        v1 = self[2].get_value()
        l.append(('Tempo', '%.1f' % v1))
        v2 = self[3].get_value()
        l.append(('Beats', v2))
        if self.__playing:
            v3 = 'Yes'
        else:
            v3 = 'No'
        l.append(('Running', v3))
        if self[16].get_value():
            v5 = 'Yes'
        else:
            v5 = 'No'
        l.append(('Midi clock sync', v5))
        v6 = self[17].get_value()
        l.append(('Midi clock latency (ms)', v6))

        return logic.render_term(T('keyval', tuple(l)))
예제 #27
0
    def get_dinfo(self):
        l = []
        dsc = self.get_description()
        l.append(('dinfo_id', dsc))
        k = 'master'
        v = '%d' % self[2][1].get_value()
        l.append((k + ' volume', v))

        l2 = []

        for c in self.channels.values():
            if c.inuse():
                l2.extend(c.get_dinfo())

        l3 = []

        for c in self.fxchannels.values():
            if c.inuse():
                l3.extend(c.get_dinfo())

        l2.sort()
        l3.sort()

        return logic.render_term(T('keyval', tuple(l + l2 + l3)))
예제 #28
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        agent.Agent.__init__(
            self,
            signature=version,
            names='synth filter',
            container=(10, 'agent',
                       atom.VerbContainer(clock_domain=self.domain)),
            ordinal=ordinal)

        self[1] = bundles.Output(1, True, names="low pass output")
        self[2] = bundles.Output(2, True, names="high pass output")
        self[3] = bundles.Output(3, True, names="band pass output")

        self.output = bundles.Splitter(self.domain, self[1], self[2], self[3])
        self.filter = synth_native.synthfilter(self.output.cookie(),
                                               self.domain)
        self.bend_filter = piw.function2(
            True, 3, 4, 1, piw.makefloat_bounded_nb(96000, 0, 0, 440, 0),
            piw.makefloat_bounded_nb(1, -1, 0, 0, 0), self.filter.cookie())
        self.bender = piw.fast_pitchbender()
        self.bend_filter.set_functor(self.bender.bend_functor())
        self.input = bundles.VectorInput(self.bend_filter.cookie(),
                                         self.domain,
                                         signals=(5, 2, 3, 4),
                                         threshold=5)
        self.input.add_upstream(self.verb_container().clock)

        self[4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names="audio input",
                            policy=self.input.vector_policy(5, True))
        self[5] = atom.Atom(domain=domain.BoundedFloat(
            0,
            1,
            rest=0.5,
            hints=(T('control', 'updown'), T('inc', 0.01), T('biginc', 0.05))),
                            names="resonance input",
                            policy=self.input.merge_policy(2, False))
        self[6] = atom.Atom(domain=domain.BoundedFloat(0, 96000),
                            init=5000,
                            names="cutoff frequency input",
                            policy=self.input.merge_policy(3, False))
        self[7] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names="bend input",
                            policy=self.input.merge_policy(4, False))

        self[8] = atom.Atom(domain=domain.BoundedFloat(0, 72),
                            init=24,
                            policy=atom.default_policy(self.__rchange),
                            names='frequency range',
                            protocols='bind set',
                            container=(None, 'range', self.verb_container()))
        self[8].add_verb2(
            1,
            'set([],None,role(None,[instance(~self)]),role(to,[]))',
            create_action=self.__rcreate,
            clock=True)

        self[9] = atom.Atom(domain=domain.BoundedFloat(-144, 144, rest=0),
                            init=24,
                            policy=atom.default_policy(self.__ochange),
                            names='frequency offset',
                            protocols='bind set',
                            container=(None, 'offset', self.verb_container()))
        self[9].add_verb2(
            2,
            'set([],None,role(None,[instance(~self)]),role(to,[]))',
            create_action=self.__ocreate,
            clock=True)

        self.__rchange(24)
        self.__ochange(24)
예제 #29
0
    def __init__(self, name):
        agent.Agent.__init__(self,
                             signature=upgrade.Signature(),
                             names='eigenbrowser',
                             volatile=True)

        self.name = name
        self.node = random.randrange(0, 1 << 48L) | 0x010000000000L

        self.langModel = gui.call_bg_sync(self.__create_lang)
        self.historyModel = history.HistoryModel(self.langModel)
        self.cdomain = piw.clockdomain_ctl()
        self.cdomain.set_source(piw.makestring('*', 0))

        self.scroller1 = Scroller2(
            self.__scroll1)  # scrolls the left hand pane
        self.scroller2 = Scroller(
            self.__scroll2, self.__tap2)  # scrolls the right hand (dinfo) pane
        self.scroller3 = Scroller(self.__scroll3,
                                  self.__tap3)  # scrolls the path pane

        self.scroller_in1 = bundles.VectorInput(self.scroller1.cookie(),
                                                self.cdomain,
                                                signals=(1, 2, 3))
        self.scroller_in2 = bundles.VectorInput(self.scroller2.cookie(),
                                                self.cdomain,
                                                signals=(1, 2, 3))
        self.scroller_in3 = bundles.VectorInput(self.scroller3.cookie(),
                                                self.cdomain,
                                                signals=(1, 2, 3))

        nudge = (T('inc', 0.1), )
        self[1] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                            init=0,
                            names='sideways nudger',
                            ordinal=1,
                            policy=self.scroller_in1.vector_policy(1, False))
        #self[2] = atom.Atom(domain=domain.BoundedFloat(-1,1,hints=nudge), init=0, names='vertical nudger', ordinal=1, policy=self.scroller_in1.vector_policy(2,False),rtransient=True)
        self[2] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                            init=0,
                            names='vertical nudger',
                            ordinal=1,
                            policy=self.scroller_in1.vector_policy(2, False))

        self[3] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                            init=0,
                            names='sideways nudger',
                            ordinal=2,
                            policy=self.scroller_in2.vector_policy(1, False))
        self[4] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                            init=0,
                            names='vertical nudger',
                            ordinal=2,
                            policy=self.scroller_in2.vector_policy(2, False))

        self[8] = browse.BrowseAgent(self, browse.getName())

        self.add_verb2(1,
                       'browse([],None,role(None,[proto(browse),singular]))',
                       callback=self.__do_browse)
        self.add_verb2(2, 'minimise([],None)', callback=self.__minimise)
        self.add_verb2(3, 'maximise([],None)', callback=self.__maximise)

        self.font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
        self.font.SetPointSize(fonts.DEFAULT_PTS)

        self[12] = atom.Atom(domain=domain.BoundedInt(5, 20, rest=11),
                             names='text',
                             policy=atom.default_policy(self.__set_fontsize))
        self[15] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                             init=-1,
                             names='sideways nudger',
                             ordinal=3,
                             policy=self.scroller_in3.vector_policy(1, False))
        self[16] = atom.Atom(domain=domain.BoundedFloat(-1, 1, hints=nudge),
                             init=-1,
                             names='vertical nudger',
                             ordinal=3,
                             policy=self.scroller_in3.vector_policy(2, False))
        self[17] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                             init=0,
                             names='tapper',
                             ordinal=1,
                             policy=self.scroller_in1.vector_policy(3, False))
        self[18] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                             init=0,
                             names='tapper',
                             ordinal=2,
                             policy=self.scroller_in2.vector_policy(3, False))
        self[19] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                             init=0,
                             names='tapper',
                             ordinal=3,
                             policy=self.scroller_in3.vector_policy(3, False))

        self.__size = node.Server(change=self.__size_changed)
        self.set_private(node.Server())
        self.get_private()[1] = self.__size
        self.__x = 100
        self.__y = 100
        self.__setup_size()

        self.__minX = 60
        self.__minY = 80
        self.__maxX = 100
        self.__maxY = 100

        self.__rootFrame = None
        self.__createRootFrame()

        #        self.scroller2.reset(-1,-1)
        self.scroller3.reset(-1, 1)
        self.scroller1.set_scheme(1)

        self.scroller1.enable()
        self.scroller2.enable()
        self.scroller3.enable()
예제 #30
0
    def __init__(self, address, ordinal):
        # the agent event clock
        self.domain = piw.clockdomain_ctl()

        # verb container, used by all taps
        agent.Agent.__init__(self,
                             signature=version,
                             names='convolver',
                             container=3,
                             ordinal=ordinal)

        self.vol = piw.make_f2f_table(
            -24, 24, 1000, picross.make_f2f_functor(volume_function))

        # outputs
        self[1] = bundles.Output(1, True, names="left audio output")
        self[2] = bundles.Output(2, True, names="right audio output")
        self.output = bundles.Splitter(self.domain, self[1], self[2])

        # the convolver class
        self.convolver = convolver_native.convolver(self.vol,
                                                    self.output.cookie(),
                                                    self.domain)

        # input has the correlator and a bundle style output
        self.input = bundles.ScalarInput(self.convolver.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4))

        # self[3] = verb container

        self[4] = ImpulseBrowser(self)

        # audio inputs
        # use vector policy inputs
        self[5] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names="left audio input",
                            policy=self.input.nodefault_policy(1, True))
        self[6] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                            names="right audio input",
                            policy=self.input.nodefault_policy(2, True))

        # wet/dry mix
        self[7] = atom.Atom(domain=domain.BoundedFloat(
            -24,
            24,
            hints=(T('stageinc', 0.1), T('inc',
                                         0.1), T('biginc',
                                                 1), T('control', 'updown'))),
                            init=0,
                            names="dry gain",
                            protocols='input',
                            policy=self.input.merge_policy(3, False))
        self[11] = atom.Atom(domain=domain.BoundedFloat(
            -24,
            24,
            hints=(T('stageinc', 0.1), T('inc',
                                         0.1), T('biginc',
                                                 1), T('control', 'updown'))),
                             init=0,
                             names="wet gain",
                             protocols='input',
                             policy=self.input.merge_policy(4, False))
        # effect enable
        self[8] = atom.Atom(domain=domain.Bool(),
                            init=True,
                            names="enable",
                            protocols='input',
                            policy=atom.default_policy(self.__set_enable))
        # mono processing mode
        self[9] = atom.Atom(domain=domain.Bool(),
                            init=False,
                            names="mono",
                            policy=atom.default_policy(
                                self.__set_mono_processing))
        # enable time, time to fade in and out when enabling in ms
        self[10] = atom.Atom(
            names='enable time input',
            domain=domain.BoundedFloat(0,
                                       100000,
                                       hints=(T('stageinc', 1), T('inc', 1),
                                              T('biginc',
                                                10), T('control', 'updown'))),
            init=100,
            policy=atom.default_policy(self.__set_enable_time))

        self.__set_enable(self[8].get_value())
        self.__set_mono_processing(self[9].get_value())
        self.__set_enable_time(self[10].get_value())

        self.add_verb2(
            1,
            'choose([],None,role(None,[ideal([~server,impulse]),singular]))',
            self.__choose)