Exemplo n.º 1
0
    def __init__(self, piylights):
        # Setup recorder
        FS = 44100
        recorder = SoundCardDataSource(num_chunks=1, sampling_rate=FS, chunk_size=441)
        #chunk size set for updates every 10ms
        #better keep this fixed now...

        self.win = self.LiveFFTWindow(recorder, piylights)
        self.interval_s = self.win.interval_s
        self.win.daemon = True
        self.win.start()
Exemplo n.º 2
0
            self.recorder.num_chunks *= 2
            self.resetRanges()
        elif text == "-":
            self.recorder.num_chunks /= 2
            self.resetRanges()
        elif text == "p":
            self.showPeaks = not self.showPeaks
        else:
            super(LiveFFTWindow, self).keyPressEvent(event)


# Setup plots
#QtGui.QApplication.setGraphicsSystem('opengl')
app = QtGui.QApplication([])
#pg.setConfigOptions(antialias=True)

# Setup recorder
#FS = 12000
#FS = 22000
FS = 44000
recorder = SoundCardDataSource(num_chunks=3,
                               sampling_rate=FS,
                               chunk_size=4 * 1024)
win = LiveFFTWindow(recorder)

## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()