vak.prep.spectrogram_dataset.spect.spectrogram#

vak.prep.spectrogram_dataset.spect.spectrogram(dat, samp_freq, fft_size=512, step_size=64, thresh=None, transform_type=None, freq_cutoffs=None)[source]#

creates a spectrogram

Parameters:
  • dat (numpy.ndarray) – audio signal

  • samp_freq (int) – sampling frequency in Hz

  • fft_size (int) – size of window for Fast Fourier transform, number of time bins.

  • step_size (int) – step size for Fast Fourier transform

  • transform_type (str) – one of {‘log_spect’, ‘log_spect_plus_one’}. ‘log_spect’ transforms the spectrogram to log(spectrogram), and ‘log_spect_plus_one’ does the same thing but adds one to each element. Default is None. If None, no transform is applied.

  • thresh (int) – threshold minimum power for log spectrogram

  • freq_cutoffs (tuple) – of two elements, lower and higher frequencies.

Returns:

  • spect (numpy.ndarray) – spectrogram

  • freqbins (numpy.ndarray) – vector of centers of frequency bins from spectrogram

  • timebins (numpy.ndarray) – vector of centers of time bins from spectrogram