STFT Class

Short Time Fourier Transform (STFT)

class spiegelib.features.STFT(fft_size=1024, hop_size=512, output='complex', scale_axis=None, **kwargs)

Bases: spiegelib.features.features_base.FeaturesBase

Parameters
  • fft_size (int, optional) – size of FFT, defaults to 1024

  • hop_size (int, optional) – size of hop shift in samples, defuault to 512

  • 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 STFT on audio buffer.

Parameters

audio (AudioBuffer) – input audio

Returns

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

Return type

np.ndarray