예제 #1
0
    def drawSpectra(self, data, samplerate):
        leftData, rightData = utils.channels(data)
        leftPoints, rightPoints = [], []
        width, _ = self.windowSize

        # buffer left/right data
        self.leftBuffer.add(leftData)
        if (self.leftBuffer.filled):
            leftSpectrum = self.buildSpectrum(self.leftBuffer.data)
            # slicing the data breaks pitch dection outside of the window.
            # (full range of the fft bins. doesn't have to fall inside the window.)
            leftSpectrum = self.avgLeft.average(leftSpectrum)
            leftPoints = self.drawSpectrum(leftSpectrum)
            freq = self.calcFreq(leftSpectrum, samplerate)
            self.printText(
                "L Freq: {0:.2f}Hz {1}".format(freq, audio.pitch(freq)), 0,
                self.leftcolor)

        self.rightBuffer.add(rightData)
        if (self.rightBuffer.filled):
            rightSpectrum = self.buildSpectrum(self.rightBuffer.data)
            rightSpectrum = self.avgRight.average(rightSpectrum)
            rightPoints = self.drawSpectrum(rightSpectrum)
            freq = self.calcFreq(rightSpectrum, samplerate)
            self.printText(
                "R Freq: {0:.2f}Hz {1}".format(freq, audio.pitch(freq)), 1,
                self.rightcolor)

        return leftPoints, rightPoints
예제 #2
0
파일: filters.py 프로젝트: modrzew/ekoie
def slow_down(track):
    """Slows down the track"""
    rate = random.uniform(*config.SLOW_DOWN_RANGE)
    return audio.pitch(track, round(rate, 2))
예제 #3
0
파일: filters.py 프로젝트: modrzew/ekoie
def speed_up(track):
    """Speeds up the track"""
    rate = random.uniform(*config.SPEED_UP_RANGE)
    return audio.pitch(track, round(rate, 2))