From: Guillaume Pellerin Date: Wed, 8 Jan 2014 16:17:30 +0000 (+0100) Subject: fix fft_size arg for spectrogram X-Git-Tag: 0.5.3~29^2~2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=14345dcdbe213366a37c18c1c71d37948c1d4e31;p=timeside.git fix fft_size arg for spectrogram --- diff --git a/timeside/analyzer/spectrogram.py b/timeside/analyzer/spectrogram.py index 3357448..2cc29c2 100644 --- a/timeside/analyzer/spectrogram.py +++ b/timeside/analyzer/spectrogram.py @@ -29,10 +29,7 @@ import numpy as np class Spectrogram(Analyzer): implements(IAnalyzer) - values = [] - FFT_SIZE = 2048 - - def __init__(self, blocksize=2048, stepsize=None): + def __init__(self, blocksize=2048, stepsize=None, fft_size=None): super(Spectrogram, self).__init__() self.input_blocksize = blocksize @@ -41,12 +38,19 @@ class Spectrogram(Analyzer): else: self.input_stepsize = blocksize / 2 + if not fft_size: + self.FFT_SIZE = blocksize + else: + self.FFT_SIZE = fft_size + + values = [] + @interfacedoc def setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None): super(Spectrogram, self).setup(channels, samplerate, blocksize, totalframes) - + @staticmethod @interfacedoc def id():