FFT Class

Fast Fourier Transform (FFT)

class spiegelib.features.FFT(fft_size=None, output='complex', scale_axis=None, **kwargs)

Bases: spiegelib.features.features_base.FeaturesBase

Parameters
  • fft_sze (int, optional) – Size of FFT to use. If set, will truncate input if input is smaller than FFT size. If FFT size is larger than input, will zero-pad. Defaults to None, so FFT will be the size of input.

  • output (str, optional) – output type, must be one of [‘complex’, ‘magnitude’, ‘power’, ‘magnitude_phase’, ‘power_phase’] Defaults to ‘complex’.

  • scale_axis (int, tuple, None) – When applying scaling, determines which dimensions scaling be applied along. Defaults to None, which will flatten results and calculate scaling variables on that.

  • kwargs – Keyword arguments, see spiegelib.features.features_base.FeaturesBase.

get_features(audio)

Run FFT on audio buffer.

Parameters

audio (AudioBuffer) – input audio

Returns

Results of FFT. Format depends on output type set during construction.

Return type

np.ndarray