def run(self): self.universe = Universe(self.bands) for channel in self.universe: channel.addListener(self) fixtures = self.getFixtures() self.outputs = [] self.ratio = float(len(fixtures)) / self.bands start = 0 for i in range(self.bands): end = int((i+1) * self.ratio) self.outputs.append(VUOutput(fixtures[start:end], self.colorConfig)) start = end self.reader = FFTReader(AudioReader.instance("hw:1,0"), self.universe, self.bands) self.reader.start() self.endEvent.wait()
def run(self): lo = 4000 hi = 32000 log_lo = math.log(lo) log_hi = math.log(hi) fixtures = self.fixtureList.filter(lambda f : f.hasTag('strip')) output = VUOutput(fixtures) audioReader = AudioReader.instance(self.card) #audioReader.start() while self.doRun: audioReader.event.wait() vu = (math.log(float(max(audioop.max(audioReader.data, 2), 1))) - log_lo) / (log_hi - log_lo) vu = min(max(vu, 0), 1) output.update(vu) #audioReader.stop() output.stop() self.endEvent.set()