spafe.utils.spectral#

spafe.utils.spectral.compute_constant_qtransform(frames: List[ndarray], fs: int = 16000, low_freq: float = 0, high_freq: Optional[float] = None, nfft: int = 512, number_of_octaves: int = 7, number_of_bins_per_octave: int = 12, win_type: typing_extensions.Literal[hanning, bartlet, kaiser, blackman, hamming] = 'hamming', spectral_threshold: float = 0.0054, f0: float = 120, q_rate: float = 1.0)[source]#

Compute the constant Q-transform as described in [Browm1991], [Brown1992] and [Schörkhuber].

Parameters
  • frames (list) – list of audio frames (list of numpy.ndarray).

  • fs (int) – the sampling frequency of the signal we are working with. (Default is 16000).

  • low_freq (float) – lowest band edge of mel filters (Hz). (Default is 0).

  • high_freq (float) – highest band edge of mel filters (Hz). (Default is samplerate / 2).

  • nfft (int) – number of FFT points. (Default is 512).

  • number_of_octaves (int) – number of occtaves. (Default is 7).

  • number_of_bins_per_octave (int) – numbers of bins oer occtave. (Default is 24).

  • win_type (str) – window type to apply for the windowing. (Default is “hamming”).

  • spectral_threshold (float) – spectral threshold. (Default is 0.005).

  • f0 (float) – fundamental frequency. (Default is 28).

  • q_rate (float) – number of FFT points. (Default is 1.0).

Returns

the constant q-transform.

Return type

(numpy.ndarray)

References

Browm1991

: Brown, J. C. (1991). Calculation of a constant Q spectral transform. The Journal of the Acoustical Society of America, 89(1), 425–434. doi:10.1121/1.400476

Brown1992

: Brown, J. C. & Puckette, M. (1992). “An efficient algorithm for the calculation of a constant Q transform”. Journal of the Acoustical Society of America. 92. 2698. 10.1121/1.404385.

Schörkhuber

: Schörkhuber, C. “Constant-Q transform toolbox for music processing.” 7th Sound and Music Computing Conference, Barcelona, Spain. 2010.