Beispiel #1
0
 def __init__(self, dur=5.0, name="ts"):
     Thread.__init__(self)
     self.duration = dur # duration in seconds
     self.group_id = tools.nextNodeID()
     self.inbuf = tools.nextNodeID()
     self.outbuf = tools.nextNodeID()
     self.bufsize = 65536
     #self.path = "/Users/davk/Music/" + str(time.time()) + ".aif        
     self.paths = ["/Users/davk/Music/ts_" + name + "_0.aif",
                  "/Users/davk/Music/ts_" + name + "_1.aif"]
     self.path = self.paths[0]
     
     self.sendMsg("g_new", self.group_id, 1, 0)
Beispiel #2
0
 def note_on(self, note, args):
     """
     Do the note on. Pass relevant parameter settings as alternating key
     value arguments.
     """
     if note in self.voices:
         self.voices[note].append(tools.nextNodeID())
     else:
         self.voices[note] = [tools.nextNodeID()]
     
     for i in range(0, len(args), 2):
         self.params[args[i]] = args[i+1] 
             
     msg = (['s_new', self.name, self.voices[note][-1], 0, self.groupID] + 
      [val for pair in zip(self.params.keys(), self.params.values()) 
       for val in pair]) 
     self.s.listSendMsg(msg);
Beispiel #3
0
 def __init__(self, sdname=None):
     object.__init__(self)
     # initialize the data
     self.groupID = tools.nextNodeID()
     self.voices = {}
     self.params = {}
     self.name = sdname
     self.s = controller.Controller(("192.168.1.100", 57111))
     
     # run startup functions
     self.s.sendMsg('g_new', self.groupID, 1, 1)
Beispiel #4
0
 def start(self, delayTime=2.0, numdelays=1):
     if self.running:
         return
     else:
         self.running = True
         for server in s:
             server.sendMsg('g_new', self.group_id, 1, 0)
             # wait for the group to be created before creating the synth
             # lazy edition
             time.sleep(0.5)
             for i in range(numdelays):
                 
                 delay_offset = delayTime * i
                 if i >= len(self.bufnums):
                     self.bufnums.append(tools.nextNodeID())
                 # let the server reject this call if the buffer exists
                 server.sendMsg('b_alloc', self.bufnums[i], 44100 * 16, 2)
                 server.sendMsg('s_new', 'ts_delay', -1, 1, self.group_id,
                                'delayTime', delayTime + delay_offset,
                                'lev', 1.0,
                                'bufnum', self.bufnums[i])