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)
def __init__(self, controller, index, tag): atom.Atom.__init__(self, names="connector", ordinal=index, protocols='remove') self.controller = controller self.index = index self.control = None self.monitor = None self[1] = atom.Atom(domain=domain.BoundedInt(-32767, 32767), names='key column', init=0, policy=atom.default_policy( self.__change_key_column), protocols="input explicit") self[2] = atom.Atom(domain=domain.BoundedInt(-32767, 32767), names='key row', init=0, policy=atom.default_policy(self.__change_key_row), protocols="input explicit") self[3] = atom.Atom(domain=domain.Bool(), names='key column end relative', init=False, policy=atom.default_policy( self.__change_key_column_endrel), protocols="input explicit") self[5] = atom.Atom(domain=domain.Bool(), names='key row end relative', init=False, policy=atom.default_policy( self.__change_key_row_endrel), protocols="input explicit") self[4] = ConnectorOutput(self)
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='control voltage calibration', ordinal=ordinal) self.domain = piw.clockdomain_ctl() self[1] = atom.Atom(names='outputs') self[1][1] = bundles.Output(1, False, names='voltage output') self[1][2] = bundles.Output(2, False, names='calibration output') self.output = bundles.Splitter(self.domain, self[1][1], self[1][2]) self.cv_calibration = cv_calibration_native.cv_calibration( self.output.cookie(), self.domain) self.input = bundles.VectorInput(self.cv_calibration.cookie(), self.domain, signals=(1, )) self[2] = atom.Atom(names='inputs') self[2][1] = atom.Atom(domain=domain.BoundedFloat(0, 96000, rest=0), names="frequency input", policy=self.input.vector_policy(1, False)) self.add_verb2(1, 'calibrate([],None)', callback=self.__calibrate)
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')
def __init__(self, agent): self.__agent = agent audio.AudioInput.__init__(self, self.__agent.audio_input, 1, 2, names='headphone') self[100] = toggle.Toggle(self.__enable, self.__agent.domain, container=(None, 'headphone', self.__agent.verb_container()), names='enable') self[101] = atom.Atom(domain=domain.BoundedInt( 0, 127, hints=(T('stageinc', 1), T('inc', 1), T('biginc', 5), T('control', 'updown'))), names='gain', init=70, policy=atom.default_policy(self.__gain)) self[102] = atom.Atom(domain=domain.BoundedInt(0, 4), names='quality', init=0, policy=atom.default_policy(self.__quality)) self[103] = atom.Atom(domain=domain.Bool(), names='limit', init=True, policy=atom.default_policy(self.__limit)) self[103].set_property_string( 'show_warning', 'BY CHANGING THE PRESET HEADPHONE LIMIT YOU ABSOLVE EIGENLABS LTD OF ALL LIABILITY FOR ANY HEARING DAMAGE THAT MAY BE CAUSED AS A RESULT OF SUCH ACTIONS' )
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='noise oscillator', ordinal=ordinal) self.domain = piw.clockdomain_ctl() # One Iso output for the noise 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.osc = synth_noise.noise(self.output.cookie(), self.domain) # Two Iso inputs, volume, and filter freq self.input = bundles.VectorInput(self.osc.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, 20000), names="filter frequency input", policy=self.input.merge_policy(2, True))
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='orb', ordinal=ordinal) self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*', 0)) self[2] = atom.Atom(names="outputs") 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 = orb(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')
def __init__(self,agent): self.__agent = agent audio.AudioInput.__init__(self,self.__agent.audio_input,1,2,names='headphone') self[100] = toggle.Toggle(self.__enable,self.__agent.domain,container=(None,'headphone',self.__agent.verb_container()),names='enable') self[101] = atom.Atom(domain=domain.BoundedInt(0,127,hints=(T('inc',1),T('biginc',5),T('control','updown'))),names='gain',init=70,policy=atom.default_policy(self.__gain)) self[102] = atom.Atom(domain=domain.BoundedInt(0,4),names='quality',init=0,policy=atom.default_policy(self.__quality)) self[103] = atom.Atom(domain=domain.Bool(),names='limit',init=True,policy=atom.default_policy(self.__limit))
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()
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='rectangle 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.rect(self.output.cookie(), self.domain) self.input = bundles.VectorInput(self.osc.cookie(), self.domain, signals=(1, 2, 3, 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), names="frequency input", policy=self.input.merge_policy(2, False)) self[4] = atom.Atom(domain=domain.BoundedFloat(0.1, 0.9, rest=0.5), names="pulse width input", policy=self.input.merge_policy(3, False)) self[5] = atom.Atom(domain=domain.BoundedFloat(-1200, 1200), names='detune input', policy=self.input.merge_policy(4, False))
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='sawtooth 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.sawtooth(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), init=0, 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))
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='labeler', ordinal=ordinal) self.domain = piw.clockdomain_ctl() self[1] = atom.Atom( domain=domain.Aniso(hints=(logic.make_term('continuous'), )), names='controller output', policy=atom.readonly_policy()) self[2] = atom.Atom(domain=domain.String(), init='Label', names='label category', policy=atom.default_policy(self.__set_category)) self[3] = atom.Atom(domain=domain.String(), init='', names='label', policy=atom.default_policy(self.__set_label)) self.ctl_functor = piw.functor_backend(1, True) self.ctl_input = bundles.VectorInput(self.ctl_functor.cookie(), self.domain, signals=(1, )) self[4] = atom.Atom(domain=domain.Aniso(), policy=self.ctl_input.vector_policy(1, False), names='controller input') self.ctl_functor.set_functor( piw.pathnull(0), utils.make_change_nb( piw.slowchange(utils.changify(self.__controller_input)))) self.__ctl = []
def __init__(self, address, ordinal): agent.Agent.__init__(self, signature=version, names='shaper', ordinal=ordinal) self[3] = bundles.Output(1, False, names='output') self.domain = piw.clockdomain_ctl() self.output = bundles.Splitter(self.domain, self[3]) Z = piw.makefloat_bounded(1, 0, 0, 0, 0) self.compress = piw.function1(False, 1, 1, Z, self.output.cookie()) self.compress.set_functor(synth_native.compressor(0)) self.sharpen = piw.function1(False, 1, 1, Z, self.compress.cookie()) self.sharpen.set_functor(synth_native.sharpener(0)) self.input = bundles.VectorInput(self.sharpen.cookie(), self.domain, signals=(1, )) self[2] = atom.Atom(domain=domain.BoundedFloat(-1, 1), policy=self.input.vector_policy(1, False), names='input') self[1] = atom.Atom(names='controls') self[1][1] = atom.Atom(domain=domain.BoundedFloat(0, 1), names="compression", policy=atom.default_policy(self.__compression)) self[1][2] = atom.Atom(domain=domain.BoundedFloat(0, 1), names="sharpness", policy=atom.default_policy(self.__sharpness))
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)
def __init__(self, address, ordinal): agent.Agent.__init__(self,signature=version,names='clicker',container=3,ordinal=ordinal) self.domain = piw.clockdomain_ctl() accent = wav_resource('accent.wav') beat = wav_resource('beat.wav') self[1] = bundles.Output(1,True,names='audio output') self.output = bundles.Splitter(self.domain, self[1]) self.clicker = loop_native.clicker(self.output.cookie(),self.domain,accent,beat) self.input = bundles.ScalarInput(self.clicker.cookie(), self.domain, signals=(1,2)) self[2] = atom.Atom() 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='bar beat input') self.add_verb2(1,'play([],None)',self.__play,status_action=self.__status) self.add_verb2(2,'play([un],None)',self.__unplay,status_action=self.__status) self.add_verb2(3,'play([toggle],None)',self.__toggle,status_action=self.__status) self[4]=bundles.Output(1,False,names='status output') self.light_output=bundles.Splitter(self.domain,self[4]) self.lights=piw.lightsource(piw.change_nb(),0,self.light_output.cookie()) self.lights.set_size(1) self.lights.set_status(1,const.status_inactive) self.__playstate = node.Server(value=piw.makebool(True,0),change=self.__playchanged) self.set_private(self.__playstate) self.__playing=False
def __init__(self, address, ordinal): agent.Agent.__init__(self,signature=version,names='talker',container=5,ordinal=ordinal) self.add_mode2(4,'mode([],role(when,[singular,numeric]),option(using,[instance(~server)]))', self.__mode, self.__query, self.__cancel_mode, self.__attach_mode) self.add_mode2(7,'mode([],role(when,[singular,numeric]),role(called,[singular,numeric]),option(using,[instance(~server)]))', self.__cmode, self.__cquery, self.__cancel_mode, self.__attach_mode) self.add_verb2(1,'cancel([],None,role(None,[ideal([~server,event])]))', self.__cancel_verb) self.add_verb2(8,'cancel([],None,role(None,[singular,numeric]),role(called,[singular,numeric]))', self.__cancel_verb_called) self.add_verb2(5,'colour([],None,role(None,[singular,numeric]),role(to,[singular,numeric]))', self.__color_verb) self.add_verb2(6,'colour([],None,role(None,[singular,numeric]),role(to,[singular,numeric]),role(from,[singular,numeric]))', self.__all_color_verb) self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*',0)) self.__size = 0 self[1] = bundles.Output(1,False, names='light output',protocols='revconnect') self.light_output = bundles.Splitter(self.domain,self[1]) self.light_convertor = piw.lightconvertor(self.light_output.cookie()) self.light_aggregator = piw.aggregator(self.light_convertor.cookie(),self.domain) self.controller = piw.controller(self.light_aggregator.get_output(1),utils.pack_str(1)) self.activation_input = bundles.VectorInput(self.controller.cookie(), self.domain,signals=(1,)) self[2] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.activation_input.local_policy(1,False),names='activation input') self[3] = atom.Atom(creator=self.__create,wrecker=self.__wreck) self[4] = PhraseBrowser(self.__eventbykey,self.__keylist)
def __init__(self, agent, index): atom.Atom.__init__(self, names='audiocube', ordinal=index) self.__agent = agent self.__index = index self[4] = bundles.Output(1, False, names='sensor output 1') self[5] = bundles.Output(2, False, names='sensor output 2') self[6] = bundles.Output(3, False, names='sensor output 3') self[7] = bundles.Output(4, False, names='sensor output 4') self.__output = bundles.Splitter(self.__agent.domain, self[4], self[5], self[6], self[7]) self.__inputcookie = self.__agent.audiocubes.create_audiocube( self.__index, self.__output.cookie()) self.__input = bundles.VectorInput(self.__inputcookie, self.__agent.domain, signals=(1, 2, 3)) self[1] = atom.Atom(domain=domain.BoundedFloat(0, 1), init=1.0, names='red input', policy=self.__input.local_policy(1, False)) self[2] = atom.Atom(domain=domain.BoundedFloat(0, 1), init=1.0, names='green input', policy=self.__input.local_policy(2, False)) self[3] = atom.Atom(domain=domain.BoundedFloat(0, 1), init=1.0, names='blue input', policy=self.__input.local_policy(3, False))
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=(2, 8, 9, 10, 11), threshold=5) time = (T('stageinc', 0.01), T('inc', 0.01), T('biginc', 0.2), T('control', 'updown')) self[1] = atom.Atom() 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, agent, index): self.__agent = agent self.__index = index atom.Atom.__init__(self,names='channel',ordinal=index,protocols='remove nostage') self[1] = atom.Atom(domain=domain.BoundedFloat(-1,1),names='audio input',policy=self.__agent.input.vector_policy(index,True),protocols='nostage') self[2] = atom.Atom(domain=domain.BoundedFloat(0,1),names="volume input",policy=self.__agent.input.merge_policy(index+MAX_CHANNEL,policy.IsoStreamPolicy(1,0,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()
def __init__(self, address, ordinal): self.domain = piw.clockdomain_ctl() agent.Agent.__init__(self, signature=version,names='drummer',icon='plg_loop/bass_drum_64.png',container=(4,'drummer',atom.VerbContainer(clock_domain=self.domain)),protocols='browse',ordinal=ordinal) self.updater = Updater() self.loopdb = loopdb.LoopDatabase() self.__timestamp = 0 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.domain,*self[1].values()) self.summer = piw.stereosummer(self.domain,self.output.cookie(),2) self.aggregator = piw.aggregator(self.summer.cookie(),self.domain) self.clock_cloner = piw.sclone() self.input = bundles.ScalarInput(self.clock_cloner.cookie(), self.domain,signals=(1,2)) self.input.add_upstream(self.verb_container().clock) self[2] = atom.Atom() self[2][1] = atom.Atom(domain=domain.BoundedFloat(0,100), policy=self.input.policy(1, False), names='song beat input') self[2][2] = atom.Atom(domain=domain.Bool(), init=False, policy=self.input.policy(2,False), names='running input') self[3] = LoopBrowser(self) vc = '[or([partof(~(s)"#5")],[numeric])]' 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,loop]),singular]),role(to,[abstract]))',self.__name) self.add_verb2(4,'choose([],None,role(None,[ideal([~server,loop]),singular]))',self.__choose) self.add_verb2(5,'play([],None)',create_action=self.__play,clock=True) self.add_verb2(6,'play([un],None)',create_action=self.__unplay,clock=True) self.add_verb2(7,'add([],None,option(None,[ideal([~server,loop]),singular]))',self.__add) self.add_verb2(8,'remove([],None,option(None,%s))' % vc,self.__remove) self.add_verb2(9,'select([],None,role(None,%s))' % vc,self.__select) self.add_verb2(10,'play([],None,role(None,%s))' % vc,create_action=self.__play_voice,clock=True,status_action=self.__status) self.add_verb2(11,'play([un],None,role(None,%s))' % vc,create_action=self.__unplay_voice,clock=True,status_action=self.__status) self.add_verb2(15,'first([],None,role(None,%s))' % vc,self.__firstv) self.add_verb2(16,'next([],None,role(None,%s))' % vc,self.__nextv) self.add_verb2(17,'play([once],None,role(None,%s))' % vc,create_action=self.__once,clock=True,status_action=self.__status) self.add_verb2(21,'scan([],~self)',self.__rescan) self.add_verb2(22,'play([toggle],~self,role(None,%s))' % vc,create_action=self.__toggle_voice,clock=True,status_action=self.__status) self.add_verb2(23,'play([toggle],None)',create_action=self.__toggle,clock=True) self.loop_on = piw.changelist() self.loop_off = piw.changelist() self.loop_toggle = piw.changelist() self[6]=bundles.Output(1,False,names='status output') self.light_output=bundles.Splitter(self.domain,self[6]) self.lights=piw.lightsource(piw.change_nb(),0,self.light_output.cookie()) self[5] = VoiceList(self) self[5].populate([1]) self.__first(None)
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()
def __init__(self, agent): self.__agent = agent audio.AudioOutput.__init__(self, self.__agent.audio_output, 1, 1, names='microphone') self[100] = toggle.Toggle(self.__enable, self.__agent.domain, container=(None, 'microphone enable', self.__agent.verb_container()), names='enable', transient=True) self[101] = atom.Atom( domain=domain.StringEnum(*sorted(self.mic_types.keys())), init='electret', names='type', policy=atom.default_policy(self.__type)) self[102] = atom.Atom(domain=domain.BoundedInt( 0, 50, hints=(T('stageinc', 1), T('inc', 1), T('biginc', 5), T('control', 'updown'))), names='gain', init=30, policy=atom.default_policy(self.__gain)) self[103] = toggle.Toggle(self.__pad, self.__agent.domain, container=(None, 'microphone pad', self.__agent.verb_container()), names='pad') self[104] = toggle.Toggle(self.__loop_enable, self.__agent.domain, container=(None, 'microphone loop', self.__agent.verb_container()), names='loop') self[105] = atom.Atom(domain=domain.BoundedInt( 0, 120, hints=(T('stageinc', 1), T('inc', 1), T('biginc', 5), T('control', 'updown'))), names='loop gain', init=100, policy=atom.default_policy(self.__loop_gain)) self[106] = toggle.Toggle(self.__mute_enable, self.__agent.domain, container=(None, 'microphone mute', self.__agent.verb_container()), names='automute') self[109] = atom.Atom(domain=domain.BoundedInt(0, 4), names='quality', init=2, policy=atom.default_policy(self.__quality))
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)
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)
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')
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))
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()
def __init__(self, key, fast, text, index): self.__key = key self.__index = index self.__fastdata = piw.fastdata(0) piw.tsd_fastdata(self.__fastdata) self.__fastdata.set_upstream(fast) atom.Atom.__init__(self, domain=domain.Aniso(), policy=policy.FastReadOnlyPolicy(), names='action', ordinal=index) self.get_policy().set_source(self.__fastdata) self.status_input = bundles.VectorInput( self.__key.key_aggregator.get_output(self.__index), self.__key.agent.domain, signals=(1, )) self.set_property_string('help', text) self[1] = atom.Atom(domain=domain.BoundedFloat(0, 1), policy=self.status_input.vector_policy( 1, False, clocked=False), names='status input', protocols='nostage')
def __init__(self, address, ordinal): agent.Agent.__init__(self, names='midi output', signature=version, container=3) self.set_property_long('cordinal', ordinal) self.domain = piw.clockdomain_ctl() self.domain.set_source(piw.makestring('*', 0)) self[1] = OutputMidiPort(self.domain) # midi input vector, merge down multiple MIDI input streams self.input = bundles.VectorInput(self[1].cookie(), self.domain, signals=(1, )) self[2] = atom.Atom(domain=domain.Aniso(), names="midi input", policy=self.input.vector_policy(1, False)) # self[3] is verb container # choose verb for choosing an output MIDI port self.add_verb2( 1, 'choose([],None,role(None,[ideal([~server,midiport]),singular]))', self.__chooseport) self.set_ordinal(ordinal)