示例#1
0
 def test_setup(self):
     self.add_verb2(2, 'record([],None,role(None,[mass([k])]))',
                    self.__record)
     self[16] = bundles.Output(4, False, names='test running output')
     self.toutput = bundles.Splitter(self.domain, self[16])
     self.kclone.set_filtered_output(3, self.toutput.cookie(),
                                     piw.first_filter(3))
示例#2
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='angle radius',
                             ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))

        self[2] = atom.Atom()
        self[2][1] = bundles.Output(1, False, names='angle output')
        self[2][2] = bundles.Output(2, False, names='radius output')

        self.output = bundles.Splitter(self.domain, *self[2].values())
        self.native = angle_radius(self.domain, self.output.cookie())

        self.key_input = bundles.VectorInput(self.native.cookie(),
                                             self.domain,
                                             signals=(1, 2))

        self[1] = atom.Atom(names="inputs")

        self[1][1] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.key_input.vector_policy(1, False),
                               names='roll input')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.key_input.vector_policy(2, False),
                               names='yaw input')
示例#3
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version,names='ranger',ordinal=ordinal)

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

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))
        self.output = bundles.Splitter(self.domain,*self[2].values())
        self.ranger = piw.ranger(self.domain,self.output.cookie())

        self.ctl_input = bundles.ScalarInput(self.ranger.ctl_cookie(), self.domain,signals=(1,2,3))
        self.data_input = bundles.VectorInput(self.ranger.data_cookie(), self.domain,signals=(1,))

        self[1] = atom.Atom()
        self[1][1]=atom.Atom(domain=domain.BoundedFloat(-10000000,10000000),init=-1,policy=self.ctl_input.policy(1,False),names='minimum')
        self[1][2]=atom.Atom(domain=domain.BoundedFloat(-10000000,10000000),init=1,policy=self.ctl_input.policy(2,False),names='maximum')
        self[1][3]=atom.Atom(domain=domain.BoundedFloat(-10000000,10000000),init=0,policy=self.ctl_input.policy(3,False),names='rest')
        self[1][4]=atom.Atom(domain=domain.BoundedFloat(-1,1),init=0,policy=self.data_input.vector_policy(1,False),names='input')

        self[3]=atom.Atom(domain=domain.Bool(),policy=atom.default_policy(self.__setsticky),names='sticky')
        self[4]=atom.Atom(domain=domain.BoundedFloat(-10,10),policy=atom.default_policy(self.__setcurve),names='curve')
        self[5]=atom.Atom(domain=domain.Bool(),policy=atom.default_policy(self.__setmono),names='mono')
        self[6]=atom.Atom(domain=domain.Bool(),init=True,policy=atom.default_policy(self.__setabsolute),names='absolute')

        self.ranger.set_absolute(True)
        self.add_verb2(1,'reset([],None)',self.__reset)
示例#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))
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='frequency detector',
                             ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()

        self[1] = atom.Atom(names='outputs')
        self[1][1] = bundles.Output(1, False, names='frequency output')
        self.output = bundles.Splitter(self.domain, self[1][1])

        self.frequency_detector = frequency_detector_native.frequency_detector(
            self.output.cookie(), self.domain)

        self.input = bundles.VectorInput(self.frequency_detector.cookie(),
                                         self.domain,
                                         signals=(1, ))

        self[2] = atom.Atom(names='inputs')
        self[2][1] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               names="audio input",
                               policy=self.input.vector_policy(1, True))

        self[3] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                            init=0.01,
                            policy=atom.default_policy(self.__threshold),
                            names='threshold')
        self[4] = atom.Atom(domain=domain.BoundedInt(5, 20),
                            init=10,
                            policy=atom.default_policy(self.__buffer_count),
                            names='buffer count')
示例#6
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='sine 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.osc = synth_native.sine(self.output.cookie(), self.domain)
        self.input = bundles.VectorInput(self.osc.cookie(),
                                         self.domain,
                                         signals=(1, 2, 4))

        self[2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                            names="volume input",
                            policy=self.input.local_policy(
                                1, policy.IsoStreamPolicy(1, 0, 0)))
        self[3] = atom.Atom(domain=domain.BoundedFloat(0, 96000, rest=440),
                            names="frequency input",
                            policy=self.input.merge_policy(2, False))
        self[4] = atom.Atom(init=0.0,
                            domain=domain.BoundedFloat(-1200, 1200),
                            names='detune input',
                            policy=self.input.merge_policy(4, False))
示例#7
0
    def __init__(self,usbname,ordinal,dom,remove):
        agent.Agent.__init__(self,names='keyboard pico',ordinal=ordinal,signature=version,subsystem='kbd',volatile=True,container=102,protocols='is_subsys')

        self.usbname=usbname
        self.remover=remove

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))

        self[1] = bundles.Output(1,False, names='activation output')
        self[2] = bundles.Output(2,False, names='pressure output')
        self[3] = bundles.Output(3,False, names='roll output')
        self[4] = bundles.Output(4,False, names='yaw output')

        self[5] = bundles.Output(1,False, names='strip position output')
        self[6] = bundles.Output(1,False, names='breath output')
        self[8] = bundles.Output(2,False, names='absolute strip output')
        
        self.led_backend = piw.functor_backend(1,True)
        self.status_mixer = piw.statusmixer(self.led_backend.cookie())
        self.led_input = bundles.VectorInput(self.status_mixer.cookie(),self.domain,signals=(1,))
        self[7] = atom.Atom(names='light input',protocols='revconnect',policy=self.led_input.vector_policy(1,False,False,auto_slot=True),domain=domain.Aniso())

        self.koutput = bundles.Splitter(self.domain,self[1],self[2],self[3],self[4])
        self.kpoly = piw.polyctl(10,self.koutput.cookie(),False,5)
        self.soutput = bundles.Splitter(self.domain,self[5],self[8])
        self.boutput = bundles.Splitter(self.domain,self[6])

        self.kclone=piw.sclone()
        self.kclone.set_filtered_output(1,self.kpoly.cookie(),piw.first_filter(1))
        self.kclone.set_filtered_output(2,self.soutput.cookie(),piw.first_filter(2))
        self.kclone.set_filtered_output(3,self.boutput.cookie(),piw.first_filter(3))
        self.keyboard=pkbd_native.bundle(usbname,self.kclone.cookie(),utils.notify(self.dead),utils.changify(self.signal))

        self[100] = VirtualKey()
        #self[102] = vc

        self[251] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_threshold1(), protocols='input output', names='soft threshold', policy=atom.default_policy(self.keyboard.set_threshold1))
        self[249] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_threshold2(), protocols='input output', names='hard threshold', policy=atom.default_policy(self.keyboard.set_threshold2))
        self[240] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_roll_axis_window(), protocols='input output', names='roll axis window', policy=atom.default_policy(self.keyboard.set_roll_axis_window))
        self[241] = atom.Atom(domain=domain.BoundedFloat(0,1), init=self.keyboard.get_yaw_axis_window(), protocols='input output', names='yaw axis window', policy=atom.default_policy(self.keyboard.set_yaw_axis_window))
        self[242] = atom.Atom(domain=domain.Bool(), init=False, protocols='input output nostage', names='k logging', policy=atom.default_policy(self.keyboard.enable_key_logging))

        f=self.keyboard.led_functor()
        self.led_backend.set_functor(piw.pathnull(0),f)

        self[9] = atom.Atom(names='controller output',domain=domain.Aniso(),init=self.__courses())
示例#8
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))

        agent.Agent.__init__(self, signature=version, names='stringer',protocols='bind set',container=(5,'stringer',atom.VerbContainer(clock_domain=self.domain)),ordinal=ordinal)
        
        self[1] = atom.Atom(names='outputs')
        self[1][1] = bundles.Output(1,False, names='controller output', continuous=True)
        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='key output', protocols='')

        self.output = bundles.Splitter(self.domain,self[1][2],self[1][3],self[1][4],self[1][5])
        self.coutput = bundles.Splitter(self.domain,self[1][1])

        # stringer
        self.stringer = piw.stringer(self.output.cookie())

        # clone controller input to copy it to an output and the stringer
        self.cclone = piw.clone(True) 
        self.cclone.set_output(1,self.coutput.cookie())

        self.ctl_input = bundles.VectorInput(self.cclone.cookie(),self.domain,signals=(1,))
        self.data_input = bundles.VectorInput(self.stringer.data_cookie(),self.domain,signals=(2,3,4,5))

        self[4]=atom.Atom(names='inputs')
        self[4][1]=atom.Atom(domain=domain.Aniso(),policy=self.ctl_input.vector_policy(1,False),names='controller input')
        self[4][2]=atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.data_input.merge_policy(2,False),names='pressure input',protocols='nostage')
        self[4][3]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.data_input.merge_policy(3,False),names='roll input',protocols='nostage')
        self[4][4]=atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.data_input.merge_policy(4,False),names='yaw input',protocols='nostage')
        self[4][5]=atom.Atom(domain=domain.Aniso(),policy=self.data_input.vector_policy(5,False), names='key input')

        # self[5] is the verb container

        # enable, to deactivate the stringer
        self[6] = atom.Atom(domain=domain.Bool(),init=True,names="enable",policy=atom.default_policy(self.__enable))

        # status output to drive the talker lights
        self[7]=bundles.Output(1,False,names='status output')
        self.light_output=bundles.Splitter(self.domain,self[7])
        self.lights=piw.lightsource(piw.change_nb(),0,self.light_output.cookie())
        self.lights.set_size(1)
        self.__set_lights(self[6].get_value())

        # toggle enable verb, has status action to ensure the status output will be connected to a talker
        self.add_verb2(1,'enable([toggle],None)',callback=self.__toggle_enable,status_action=self.__status)
示例#9
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='midi program chooser',
                             ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()

        self[1] = atom.Atom(names='outputs')
        self[1][1] = bundles.Output(1,
                                    False,
                                    names='light output',
                                    protocols='revconnect')
        self[1][2] = bundles.Output(2, False, names='midi output')
        self.output = bundles.Splitter(self.domain, self[1][1], self[1][2])

        self.chooser = midi_native.midi_pgm_chooser(self.output.cookie(),
                                                    self.domain)

        self.input = bundles.VectorInput(self.chooser.cookie(),
                                         self.domain,
                                         signals=(
                                             1,
                                             2,
                                         ))

        self[2] = atom.Atom(names='inputs')
        self[2][1] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.vector_policy(1, False),
                               names='key input')
        self[2][2] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.vector_policy(2, False),
                               names='controller input')

        self[3] = atom.Atom(domain=domain.Bool(),
                            init=False,
                            policy=atom.default_policy(self.__bankview),
                            names='bank view')
        self[4] = atom.Atom(domain=domain.BoundedInt(0, 127),
                            init=0,
                            policy=atom.default_policy(self.__program),
                            names='program')
        self[5] = atom.Atom(domain=domain.BoundedInt(0, 16),
                            init=1,
                            policy=atom.default_policy(self.__channel),
                            names='midi channel')
        self[6] = atom.Atom(domain=domain.BoundedInt(0, 127),
                            init=0,
                            policy=atom.default_policy(self.__window),
                            names='window')
        self[7] = atom.Atom(domain=domain.BoundedInt(0, 127),
                            init=0,
                            policy=atom.default_policy(self.__bank),
                            names='bank')

        self.add_verb2(1, 'reset([],None)', callback=self.__reset)
        self.add_verb2(2, 'up([],None)', callback=self.__up)
        self.add_verb2(3, 'down([],None)', callback=self.__down)
示例#10
0
    def __init__(self, address, ordinal):
        self.domain = piw.clockdomain_ctl()
        agent.Agent.__init__(self, signature=version, names='player', container=(const.verb_node,'player',atom.VerbContainer(clock_domain=self.domain)), ordinal=ordinal)

        self[2] = atom.Atom(names='outputs')
        self[2][1] = bundles.Output(1,False,names='pressure output', protocols='')
        self[2][2] = bundles.Output(2,False,names='key output', protocols='')
        self[2][3] = bundles.Output(3,False,names='controller output', protocols='')

        self.data_output = bundles.Splitter(self.domain,self[2][1],self[2][2])
        self.ctl_output = bundles.Splitter(self.domain,self[2][3])

        self.player = recorder_native.nplayer(self.data_output.cookie(),self.ctl_output.cookie(),16,100,self.domain)

        self[3] = atom.Atom(domain=domain.BoundedInt(1,10000,100), policy=atom.default_policy(self.player.set_size), names="size")

        self.add_verb2(1,'play([],None,role(None,[mass([note])]),role(with,[mass([velocity])]))',create_action=self.__playnv,clock=True)
        self.add_verb2(2,'play([],None,role(None,[mass([note])]),role(with,[mass([velocity])]),role(for,[mass([second])]))',create_action=self.__playnvl,clock=True)
示例#11
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)
示例#12
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             names='midi input',
                             signature=version,
                             container=6)
        self.set_property_long('cordinal', ordinal)

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))
        self.set_private(
            node.Server(value=piw.makestring('[]', 0), change=self.__settrim))

        self[1] = bundles.Output(1, False, names='activation output')
        self[2] = bundles.Output(2,
                                 False,
                                 names='continuous controller output')

        self.output = bundles.Splitter(self.domain, self[1], self[2])

        self[6] = bundles.Output(1, False, names='midi output')
        self[7] = bundles.Output(2, False, names='midi clock output')
        self.midi_output = bundles.Splitter(self.domain, self[6], self[7])

        self[3] = VirtualKey()
        self[4] = VirtualCC()
        self[5] = MidiPort(self.output.cookie(), self.midi_output.cookie())

        self.add_verb2(
            2,
            'choose([],None,role(None,[ideal([~server,midiport]),singular]))',
            self.__chooseport)
        self.add_verb2(3, 'invert([],None,role(None,[cmpdsc([~(s)"#2"])]))',
                       self.__invert)
        self.add_verb2(
            4,
            'minimise([],None,role(None,[cmpdsc([~(s)"#2"])]),option(to,[numeric]))',
            self.__setmin)
        self.add_verb2(
            5,
            'maximise([],None,role(None,[cmpdsc([~(s)"#2"])]),option(to,[numeric]))',
            self.__setmax)

        self.set_ordinal(ordinal)
示例#13
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))
示例#14
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=(2, 3, 4, 5, 6, 7, 8, 9))

        self[2] = atom.Atom(names='inputs')
        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),
                               protocols='nostage')

        # TODO: remove
        #self[2][4] = atom.Atom(names='reed stiffness input', domain=domain.BoundedFloat(0,1), init=0.5, policy=self.input.merge_policy(4,False))

        self[2][5] = atom.Atom(names='noise gain input',
                               domain=domain.BoundedFloat(0, 1),
                               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), 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), init=0, policy=self.input.merge_policy(7,False))

        self[2][8] = atom.Atom(names='pitch time input',
                               domain=domain.BoundedFloat(
                                   0,
                                   100000,
                                   hints=(T('stageinc', 10), T('inc', 10),
                                          T('biginc',
                                            1000), T('control', 'updown'))),
                               init=10,
                               policy=self.input.merge_policy(8, False))
        self[2][9] = atom.Atom(names='minimum frequency',
                               domain=domain.BoundedFloat(
                                   0.1,
                                   20,
                                   hints=(T('stageinc', 0.1), T('inc', 0.1),
                                          T('biginc',
                                            0.2), T('control', 'updown'))),
                               init=20,
                               policy=self.input.merge_policy(9, False))
示例#15
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='conductor',
                             ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()

        self.__timestamp = 0

        self[2] = atom.Atom(names='outputs')
        self[2][1] = bundles.Output(1, True, names='audio output 1')
        self.output = bundles.Splitter(self.domain, self[2][1])

        self.conductor = conductor_native.conductor(
            self.output.cookie(), self.domain,
            resource.user_resource_dir(resource.conductor_dir, version=''))

        self[1] = AudioInputChannelList(self)

        self.input_clock = bundles.ScalarInput(
            self.conductor.metronome_cookie(),
            self.domain,
            signals=(1, 2, 3, 4))
        self[3] = atom.Atom(names='metronome inputs')
        self[3][1] = atom.Atom(domain=domain.BoundedFloat(0, 10000000),
                               policy=self.input_clock.nodefault_policy(
                                   1, False),
                               names='song beat input')
        self[3][2] = atom.Atom(domain=domain.BoundedFloat(0, 100),
                               policy=self.input_clock.nodefault_policy(
                                   2, False),
                               names='bar beat input')
        self[3][3] = atom.Atom(domain=domain.Bool(),
                               init=False,
                               policy=self.input_clock.nodefault_policy(
                                   3, False),
                               names='running input')
        self[3][4] = atom.Atom(domain=domain.BoundedFloat(0, 100000),
                               init=120,
                               policy=self.input_clock.nodefault_policy(
                                   4, False),
                               names="tempo input")

        self.add_verb2(1, 'create([],None,role(None,[mass([audio,input])]))',
                       self.__create_audio_input)
        self.add_verb2(2, 'create([un],None,role(None,[mass([audio,input])]))',
                       self.__uncreate_audio_input)
        self.add_verb2(3, 'record([],None)', self.__record)
        self.add_verb2(4, 'stop([],None)', self.__stop)

        self[10] = atom.Atom("stage")
        self[10][1] = ClipPoolWidget()
        self[10][2] = ArrangeViewWidget()
        self[10][3] = SceneViewWidget()
示例#16
0
    def __init__(self,names,ordinal,dom,remove,keys):
        self.kbd_keys = keys
        agent.Agent.__init__(self,names=names,ordinal=ordinal,signature=version,subsystem='kbd',volatile=True,container=102,protocols='browse is_subsys')

        self.remover=remove

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))

        self[1] = bundles.Output(1,False,names='activation output')
        self[2] = bundles.Output(2,False,names='pressure output')
        self[3] = bundles.Output(3,False,names='roll output')
        self[4] = bundles.Output(4,False,names='yaw output')

        self[5] = bundles.Output(1,False,names='strip position output',ordinal=1)

        self[7] = bundles.Output(1,False,names='breath output')
        self[10] = bundles.Output(2,False,names='absolute strip output',ordinal=1)

        self[12] = bundles.Output(1,False,names='pedal output',ordinal=1)
        self[13] = bundles.Output(1,False,names='pedal output',ordinal=2)
        self[14] = bundles.Output(1,False,names='pedal output',ordinal=3)
        self[15] = bundles.Output(1,False,names='pedal output',ordinal=4)

        self.led_backend = piw.functor_backend(1,True)
        self.status_mixer = piw.statusmixer(self.led_backend.cookie())
        self.led_input = bundles.VectorInput(self.status_mixer.cookie(),self.domain,signals=(1,))
        self[8] = atom.Atom(names='light input',protocols='revconnect',policy=self.led_input.vector_policy(1,False,False,auto_slot=True),domain=domain.Aniso())

        self[100] = VirtualKey(self.kbd_keys)

        self.koutput = bundles.Splitter(self.domain,self[1],self[2],self[3],self[4])
        self.kpoly = piw.polyctl(10,self.koutput.cookie(),False,5)
        self.s1output = bundles.Splitter(self.domain,self[5],self[10])
        self.boutput = bundles.Splitter(self.domain,self[7])
        self.poutput1 = bundles.Splitter(self.domain,self[12])
        self.poutput2 = bundles.Splitter(self.domain,self[13])
        self.poutput3 = bundles.Splitter(self.domain,self[14])
        self.poutput4 = bundles.Splitter(self.domain,self[15])

        self.kclone=piw.sclone()
        self.kclone.set_filtered_output(1,self.kpoly.cookie(),piw.first_filter(1))
        self.kclone.set_filtered_output(2,self.s1output.cookie(),piw.first_filter(2))
        self.kclone.set_filtered_output(5,self.boutput.cookie(),piw.first_filter(5)) 
        self.kclone.set_filtered_output(6,self.poutput1.cookie(),piw.first_filter(6))
        self.kclone.set_filtered_output(7,self.poutput2.cookie(),piw.first_filter(7))
        self.kclone.set_filtered_output(8,self.poutput3.cookie(),piw.first_filter(8))
        self.kclone.set_filtered_output(9,self.poutput4.cookie(),piw.first_filter(9))

        self[9] = atom.Atom(names='controller output',domain=domain.Aniso(),init=self.courses())

        self.add_verb2(4,'maximise([],None,role(None,[mass([pedal])]))',self.__maximise)
        self.add_verb2(5,'minimise([],none,role(None,[mass([pedal])]))',self.__minimise)

        self.__timestamp = piw.tsd_time()
        self.update()
示例#17
0
    def __init__(self, database, master_agent, ordinal):
        agent.Agent.__init__(self,
                             names='controller',
                             signature=version,
                             subsystem='controller',
                             container=2,
                             protocols='is_subsys',
                             ordinal=ordinal)
        self.database = database
        self.agent = master_agent
        self.domain = master_agent.domain

        self.add_verb2(1,
                       'control([],None,role(None,[concrete,singular]))',
                       callback=self.__control)
        self.add_verb2(
            2,
            'control([],None,role(None,[concrete,singular]),role(with,[numeric]))',
            callback=self.__controlwith)
        self.add_verb2(3, 'control([un],None)', callback=self.__uncontrol)

        self[4] = atom.Atom(creator=self.__create, wrecker=self.__wreck)

        self[3] = bundles.Output(1,
                                 False,
                                 names='light output',
                                 protocols='revconnect')
        self.lights = bundles.Splitter(self.domain, self[3])
        self.lightconvertor = piw.lightconvertor(self.lights.cookie())
        self.controller = Controller0(self, self.lightconvertor.cookie(),
                                      utils.pack_str(1, 2, 3, 4, 5))
        self.clone = piw.clone(True)
        self.clone.set_output(1, self.controller.cookie())
        self.input = bundles.VectorInput(self.clone.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4, 5))

        self[1] = atom.Atom()
        self[1][1] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.input.vector_policy(1, False),
                               names='activation input')
        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(-1, 1),
                               policy=self.input.vector_policy(5, False),
                               names='strip position input')
示例#18
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)
示例#19
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='vu meter',
                             ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()

        self[1] = atom.Atom(names='outputs')
        self[1][1] = bundles.Output(OUT_LIGHT,
                                    True,
                                    names='light output',
                                    protocols='revconnect')
        self.output = bundles.Splitter(self.domain, self[1][1])

        self.native = vu_meter_native.vu_meter(self.output.cookie(),
                                               self.domain)

        self.input = bundles.VectorInput(self.native.cookie(),
                                         self.domain,
                                         signals=(IN_AUDIO, ))

        self[2] = atom.Atom(names='inputs')
        self[2][1] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               names="audio input",
                               policy=self.input.vector_policy(
                                   IN_AUDIO, policy.IsoStreamPolicy(1, -1, 0)))

        self[3] = atom.Atom(names='thresholds')
        self[3][1] = atom.Atom(domain=domain.BoundedFloat(-90, 0),
                               init=-40.0,
                               policy=atom.default_policy(self.__signal_level),
                               names='signal threshold')
        self[3][2] = atom.Atom(domain=domain.BoundedFloat(-90, 0),
                               init=-6.0,
                               policy=atom.default_policy(self.__high_level),
                               names='high threshold')
        self[3][3] = atom.Atom(domain=domain.BoundedFloat(-90, 0),
                               init=-1,
                               policy=atom.default_policy(self.__clip_level),
                               names='clip threshold')

        self[4] = atom.Atom(domain=domain.BoundedInt(1, 100),
                            init=5,
                            policy=atom.default_policy(self.__size),
                            names='size')
        self[5] = atom.Atom(domain=domain.BoundedFloat(0.0, 30),
                            init=5,
                            policy=atom.default_policy(self.__clip_hold),
                            names='clip hold')

        self.__send_parameters()
示例#20
0
    def __init__(self,address,ordinal):
        self.domain = piw.clockdomain_ctl()
        vc = atom.VerbContainer(clock_domain=self.domain)

        self.finder = talker.TalkerFinder()

        agent.Agent.__init__(self,signature=version,names='arranger', protocols='bind', container=(9,'agent',vc), ordinal=ordinal)

        self[1] = self.verb_container()

        self.model = arranger_native.model(self.domain)

        self.light_output = bundles.Output(1,False,names='light output',protocols='revconnect')
        self.light_splitter = bundles.Splitter(self.domain, self.light_output)
        self.light_convertor = piw.lightconvertor(True,self.light_splitter.cookie())
        self.view = arranger_native.view(self.model,self.light_convertor.cookie())

        self.ctlr_fb = piw.functor_backend(1,True)
        self.ctlr_fb.set_functor(piw.pathnull(0),self.view.control())
        self.ctlr_input = bundles.ScalarInput(self.ctlr_fb.cookie(),self.domain,signals=(1,))
        self[2] = atom.Atom(domain=domain.Aniso(),policy=self.ctlr_input.policy(1,False),names='controller input')

        self.kinput = bundles.VectorInput(self.view.cookie(),self.domain,signals=(1,2,3,5))
        self[3] = atom.Atom(names='key inputs')
        self[3][1] = atom.Atom(domain=domain.BoundedFloat(0,1),policy=self.kinput.vector_policy(1,False),names='pressure input',protocols='nostage')
        self[3][2] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.kinput.merge_policy(2,False),names='roll input',protocols='nostage')
        self[3][3] = atom.Atom(domain=domain.BoundedFloat(-1,1),policy=self.kinput.merge_policy(3,False),names='yaw input',protocols='nostage')
        self[3][5] = atom.Atom(domain=domain.Aniso(), policy=self.kinput.vector_policy(5,False),names='key input')
        self[3][4] = self.light_output

        self.cinput = bundles.ScalarInput(self.model.cookie(),self.domain,signals=(1,2))
        self.cinput.add_upstream(self.verb_container().clock)
        self[4] = atom.Atom(names='metronome inputs')
        self[4][1] = atom.Atom(domain=domain.Aniso(), policy=self.cinput.nodefault_policy(1,False),names='song beat input')
        self[4][2] = atom.Atom(domain=domain.Aniso(), policy=self.cinput.nodefault_policy(2,False),names='running input')

        self[5] = collection.Collection(creator=self.__createtarget,wrecker=self.__wrecktarget,names="row",inst_creator=self.__createtarget_inst,inst_wrecker=self.__wrecktarget_inst,protocols='hidden-connection explicit')

        self[7] = Parameters(self)

        self.__eventlist = EventList(self)
        self.__playstop = node.Server(change=self.__play_change)
        self.__playstop[1] = self.__eventlist
        
        self.set_private(self.__playstop)

        self.add_verb2(1,'play([],None)',create_action=self.__play,clock=True)
        self.add_verb2(2,'play([un],None)',create_action=self.__unplay,clock=True)
        self.add_verb2(3,'cancel([],None,role(None,[numeric]),option(called,[numeric]))',self.__cancel_verb)
        self.add_verb2(4,'clear([],None)',self.__clear_verb)
        self.add_verb2(5,'do([],None,role(None,[abstract]),role(when,[numeric]),option(called,[numeric]))', self.__do_verb)
        self.model.playstop_set(piw.make_change_nb(utils.slowchange(self.__play_set)))
示例#21
0
    def __init__(self, address, ordinal):
        
        agent.Agent.__init__(self,names='midi converter',signature=version,container=100,ordinal=ordinal)

        self.__domain = piw.clockdomain_ctl()

        self.__state = AgentState(self.__agent_state_loaded)
        self.set_private(self.__state)

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

        self.__observer = MappingObserver(self.__state,self)
        self.__channel_delegate = MidiChannelDelegate(self)
        self.__midi_from_belcanto = piw.midi_from_belcanto(self.__output.cookie(), self.__domain)
        self.__midi_converter = piw.midi_converter(self.__observer, self.__channel_delegate, self.__domain, self.__midi_from_belcanto, self.__get_title())
 
        self.parameter_list = inputparameter.List(self.__midi_converter,self.__midi_converter.clock_domain(),self.verb_container())

        # velocity detector, reads pressure input (signal 1) and generates a note on velocity (signal 4), passes thru all other signals in bundle
        self.__kvelo = piw.velocitydetect(self.__midi_from_belcanto.cookie(),1,4)

        # Inputs for generating keyboard driven MIDI signals
        # MIDI controllers are merged down with signals from keys (driven by pressure)
        self.__kinpt = bundles.VectorInput(self.__kvelo.cookie(),self.__domain,signals=(1,2,3,5,6,7,8,9,10,11,12,13))
        self[2] = atom.Atom()
        self[2][1] = atom.Atom(domain=domain.Aniso(),policy=self.__kinpt.vector_policy(1,False),names='pressure input')
        self[2][2] = atom.Atom(domain=domain.Aniso(),policy=self.__kinpt.merge_nodefault_policy(2,False),names='frequency input')

         # input to set the MIDI channel
        self[3] = atom.Atom(domain=domain.BoundedInt(0,16),init=0,names="midi channel",policy=atom.default_policy(self.set_midi_channel))

        # inputs to control the velocity curve
        self[4] = atom.Atom()
        self[4][1] = atom.Atom(domain=domain.BoundedInt(1,1000),init=4,names="velocity sample",policy=atom.default_policy(self.__set_samples))
        self[4][2] = atom.Atom(domain=domain.BoundedFloat(0.1,10),init=4,names="velocity curve",policy=atom.default_policy(self.__set_curve))
        self[4][3] = atom.Atom(domain=domain.BoundedFloat(0.1,10),init=4,names="velocity scale",policy=atom.default_policy(self.__set_scale))

        # bank change
        self[5]=atom.Atom(domain=domain.BoundedFloat(1,128),init=1,names="midi bank", policy=atom.default_policy(self.__set_bank_change))
        # program change
        self[6]=atom.Atom(domain=domain.BoundedFloat(1,128),init=1,names="midi program", policy=atom.default_policy(self.__set_program_change))

        # inputs to set the minimum and maximum MIDI channel when in poly mode
        self[7] = atom.Atom(domain=domain.BoundedInt(1,16),init=1,names="minimum channel",policy=atom.default_policy(self.set_min_channel))
        self[8] = atom.Atom(domain=domain.BoundedInt(1,16),init=16,names="maximum channel",policy=atom.default_policy(self.set_max_channel))

        # parameter mapping
        self[12] = self.parameter_list

        self.set_midi_channel(0)
示例#22
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             names='controller',
                             signature=version,
                             ordinal=ordinal,
                             protocols='controller')

        self.domain = piw.clockdomain_ctl()

        self[4] = ConnectorList(self)

        self[3] = bundles.Output(1,
                                 False,
                                 names='light output',
                                 protocols='revconnect')
        self.lights = bundles.Splitter(self.domain, self[3])
        self.lightconvertor = piw.lightconvertor(False, self.lights.cookie())
        self.controller = Controller0(self, self.lightconvertor.cookie(),
                                      utils.pack_str(1, 2, 3, 4, 5, 6))
        self.clone = piw.clone(True)
        self.clone.set_output(1, self.controller.event_cookie())
        self.input = bundles.VectorInput(self.clone.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4, 5, 6))

        self[1] = atom.Atom(names='inputs')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.input.vector_policy(3, False),
                               names='pressure input')
        self[1][3] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(4, False),
                               names='roll input')
        self[1][4] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(5, False),
                               names='yaw input')
        self[1][5] = atom.Atom(domain=domain.BoundedFloat(-1, 1),
                               policy=self.input.vector_policy(6, False),
                               names='strip position input')
        self[1][6] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.vector_policy(1, False),
                               names='key input')
        self[1][7] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.merge_nodefault_policy(
                                   2, False),
                               names='controller input')

        self.add_verb2(1, 'create([],None,role(None,[mass([connector])]))',
                       self.__create_connector)
        self.add_verb2(2, 'create([un],None,role(None,[mass([connector])]))',
                       self.__uncreate_connector)
示例#23
0
    def __init__(self,address,ordinal):
        agent.Agent.__init__(self, signature=version,names='audio',container=9,ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()

        self.__timestamp = 0

        self.output = bundles.Splitter(self.domain)
        self[2] = AudioOutputList(self,'outputs')

        self.clone = piw.clone(True)
        self.audio = AudioDelegate(self,self.domain)
        self.recorder = piw.wavrecorder(self.domain)
        self.clone.set_output(1,self.audio.cookie())
        self.clone.set_output(2,self.recorder.cookie())
        self.input = bundles.ScalarInput(self.clone.cookie(),self.domain,signals=(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64),threshold=0)
        self.__loading = False

        self[1] = AudioInputList(self)
        self[1].create_channel(1)
        self[1].create_channel(2)

        self[3] = atom.Atom(domain=domain.EnumOrNull(44100,48000,96000), names='sample rate', protocols='bind set', policy=atom.default_policy(self.__change_sample_rate),container=(None,'sample rate',self.verb_container()))
        self[3].add_verb2(1,'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',callback=self.__set_sample_rate)
        self[3].add_verb2(2,'set([un],~a,role(None,[instance(~self)]))',callback=self.__unset_sample_rate)

        self[4] = atom.Atom(domain=domain.BoundedIntOrNull(0,64), names='input channels', protocols='output', policy=policy.ReadOnlyPolicy())
        self[5] = atom.Atom(domain=domain.BoundedIntOrNull(0,64), names='output channels', protocols='output', policy=policy.ReadOnlyPolicy())

        self[7] = Port(self)

        self[8] = atom.Atom(domain=domain.BoundedIntOrNull(0,3072,0), names='buffer size', protocols='bind set', policy=atom.default_policy(self.__change_buffer_size),container=(None,'buffer size',self.verb_container()))
        self[8].add_verb2(1,'set([],~a,role(None,[instance(~self)]),role(to,[numeric]))',callback=self.__set_buffer_size)
        self[8].add_verb2(2,'set([un],~a,role(None,[instance(~self)]))',callback=self.__unset_buffer_size)

        self.add_verb2(1,'mute([],None)', self.__mute)
        self.add_verb2(2,'mute([un],None)', self.__unmute)
        self.add_verb2(3,'choose([],None,role(None,[ideal([~server,port]),singular]))',self.__choose)
        self.add_verb2(4,'create([],None,role(None,[mass([input])]))', self.__create_input)
        self.add_verb2(5,'create([un],None,role(None,[mass([input])]))', self.__uncreate_input)
        self.add_verb2(6,'create([],None,role(None,[mass([output])]))', self.__create_output)
        self.add_verb2(7,'create([un],None,role(None,[mass([output])]))', self.__uncreate_output)

        self.enum()

        self.__filename = resource.new_resource_file('Audio','audio.wav')
        self.recorder.setfile(self.__filename)

        self[10] = atom.Atom(domain=domain.Bool(),init=False,transient=True,policy=policy.FastPolicy(self.recorder.record(),policy.TriggerStreamPolicy()),protocols='nostage',names='recorder running input')

        self[2].channels_changed()
示例#24
0
    def __init__(self, agent, index):
        atom.Atom.__init__(self, names='hand', ordinal=index)

        self.__agent = agent
        self.__index = index

        self[1] = bundles.Output(1, False, names='palm x output')
        self[2] = bundles.Output(2, False, names='palm y output')
        self[3] = bundles.Output(3, False, names='palm z output')

        self.__output = bundles.Splitter(self.__agent.domain, self[1], self[2],
                                         self[3])
        self.__palmpoly = piw.polyctl(1, self.__output.cookie(), False, 1)
        self.__agent.eleap.create_hand(self.__index, self.__palmpoly.cookie())
示例#25
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='metronome',
                             ordinal=ordinal)

        self.beat_changes = node.Server(creator=self.__beat_creator,
                                        wrecker=self.__beat_wrecker)
        self.bar_changes = node.Server(creator=self.__bar_creator,
                                       wrecker=self.__bar_wrecker)

        self.set_private(node.Server())
        self.get_private()[1] = self.beat_changes
        self.get_private()[2] = self.bar_changes

        self[2] = atom.Atom()
        self[2][1] = bundles.Output(1, False, names='running output')
        self[2][2] = bundles.Output(2, False, names='time output')
        self[2][3] = bundles.Output(3, False, names='song beat output')
        self[2][4] = bundles.Output(5, False, names='tempo output')
        self[2][5] = bundles.Output(8, False, names='bar beat output')

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))
        self.output = bundles.Splitter(self.domain, *self[2].values())
        self.barclock = clock_native.clock(6, 1.0, 4.0, self.output.cookie(),
                                           self.domain)
        self.beatclock = clock_native.clock(2, -60.0, 60.0,
                                            self.barclock.cookie(),
                                            self.domain)
        self.input = bundles.ScalarInput(self.beatclock.cookie(),
                                         self.domain,
                                         signals=(1, 2))

        self[1] = atom.Atom()
        self[1][1] = atom.Atom(domain=domain.Bool(),
                               init=False,
                               policy=self.input.policy(1, False),
                               names='running input')
        self[1][2] = atom.Atom(domain=domain.BoundedFloat(0, 10000.0),
                               policy=self.input.policy(2, False),
                               names='time input')

        self[3] = atom.Atom()
        self[3][1] = action.Verb(
            'set(none,none,role(at,[mass([second])]),role(to,[abstract]),role(none,[matches([tempo])]))',
            lambda s, a, t, x: self.__add(a, t))
        self[3][2] = action.Verb(
            'set(dont,none,role(at,[mass([second])]),role(to,[abstract]),role(none,[matches([tempo])]))',
            lambda s, a, t, x: self.__del(a, t))
示例#26
0
    def __init__(self,ordinal,dom,remove,usbname=None,usbdev=None):
        self.type = 1
        self.usbname = usbname
        self.usbdev = usbdev
        Keyboard.__init__(self,'alpha keyboard',ordinal,dom,remove,132)

        self[6] = bundles.Output(1,False,names='strip position output',ordinal=2)
        self[11] = bundles.Output(2,False,names='absolute strip output',ordinal=2)
        self.s2output = bundles.Splitter(self.domain,self[6],self[11])
        self.kclone.set_filtered_output(4,self.s2output.cookie(),piw.first_filter(4))

        self.test_setup()
        self.nativekeyboard_setup()
        self.set_threshhold() #define in base class 
        self.setup_leds() #define in base class 
示例#27
0
    def __init__(self,address, ordinal):
        agent.Agent.__init__(self,signature=version,names='polyphonic summer',ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()

        self.__timestamp = 0

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

        self.output = bundles.Splitter(self.domain, self[2])
        self.summer = synth_native.polysummer(self.output.cookie(), self.domain)
        self.input = bundles.VectorInput(self.summer.cookie(), self.domain, signals=(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24))

        self[1] = AudioInputList(self)

        self.add_verb2(1,'create([],None,role(None,[matches([channel])]))', self.__create)
        self.add_verb2(2,'create([un],None,role(None,[numeric]))', self.__uncreate)
示例#28
0
    def __init__(self, manager, index, name="", value=""):
        self.__manager = manager
        self.__index = index
        self.name = ""
        self.value = ""
        bundles.Output.__init__(self, 1, False)
        self.__output = bundles.Splitter(self.__manager.agent.domain, self)
        self.__lights = piw.lightsource(piw.change_nb(), 0,
                                        self.__output.cookie())
        self.__private = node.Server(change=self.__change)
        self.set_private(self.__private)
        self.__alternatives = []

        if name:
            self.set_name(name)
            self.set_value(value)
示例#29
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self, signature=version, names='example', ordinal=ordinal)

        self.domain = piw.clockdomain_ctl()

        self[1] = atom.Atom(names='outputs')
        self[1][1] = bundles.Output(1, True, names='audio output')
        self.output = bundles.Splitter(self.domain, self[1][1])

        self.example = cfiltertemplate_native.example(self.output.cookie(), self.domain)

        self.input = bundles.VectorInput(self.example.cookie(), self.domain, signals=(1, 2))

        self[2] = atom.Atom(names='inputs')
        self[2][1] = atom.Atom(domain=domain.BoundedFloat(0,1), names="volume input", policy=self.input.local_policy(1,policy.IsoStreamPolicy(1,0,0)))
        self[2][2] = atom.Atom(domain=domain.BoundedFloat(0,96000, rest=440), names="frequency input", policy=self.input.merge_policy(2,False))
示例#30
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='summer',
                             ordinal=ordinal)
        self.domain = piw.clockdomain_ctl()

        self.output = bundles.Splitter(self.domain)
        self.mixer = piw.stereosummer(self.domain, self.output.cookie(), 1)
        self.input = bundles.VectorInput(self.mixer.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4, 5, 6, 7, 8, 9))

        self[2] = audio.AudioOutput(self.output, 1, 1, names='outputs')
        self[1] = audio.AudioInput(self.input, 1, 1, names='inputs')
        self[4] = audio.AudioChannels(self[1], self[2], self.mixer)