carat.features.spectrogram¶
-
carat.features.
spectrogram
(signal, fs, window_length=0.02, hop=0.01, windowing_function=<function hanning at 0x7f5b23b4b0d0>, dft_length=None, zp_flag=False)[source]¶ Calculates the Short-Time Fourier Transform a signal.
Given an input signal, it calculates the DFT of frames of the signal and stores them in bi-dimensional Scipy array.
- Args:
- window_len (float):length of the window in seconds (must be positive).
- window (callable): a callable object that receives the window length in samples and returns a numpy array containing the windowing function samples.
- hop (float): frame hop between adjacent frames in seconds.
- zp_flag (bool): a flag indicating if the Zero-Phase Windowing should be performed.
- Returns:
- spec (numpy array): spectrogram data
- time (numpy array): time in seconds of each frame
- frequnecy (numpy array): frequency grid