def _onSample(self, data): try: if isinstance(data, buffer): data = bytes(data) self.messageQueue.put_nowait(('chunk', data)) except QueueFull: ansi.error("Message queue to light process full! Continuing...")
def _onSongChanged(self, tags, songInfo): print() ansi.stdout( "Analyzing audio file: {style.fg.blue}{file.currentFilename}{style.none}\n" "{style.bold.fg.black}channels:{style.none} {file.channels}" " {style.bold.fg.black}sample rate:{style.none} {file.samplerate} Hz" " {style.bold.fg.black}duration:{style.none} {file.duration} s", file=self.sampleGen ) try: self.messageQueue.put_nowait(('songChange', self.sampleGen.currentFilename, songInfo)) except QueueFull: ansi.error("Message queue to light process full! Continuing...") self.csv.writerow([ '{} Hz'.format(f) for f in self.analyzer.fftFrequencies(self.sampleGen.samplerate) ])
def _onExit(self): if self.subProcess.is_alive(): try: self.messageQueue.put(('end', )) except QueueFull: ansi.error("Message queue to light process full! Continuing...")
def _onSongChanged(self, tags, songInfo): try: self.messageQueue.put_nowait(('songChange', self.sampleGen.currentFilename, songInfo)) except QueueFull: ansi.error("Message queue to light process full! Continuing...")
def _onSample(self): try: self.messageQueue.put_nowait(('chunk', self.sampleGen.currentData)) except QueueFull: ansi.error("Message queue to light process full! Continuing...")