pytimbre.spectral.timbral_model.timbral_util.get_spectral_features

pytimbre.spectral.timbral_model.timbral_util.get_spectral_features(audio, fs, lf_limit=20, scale='hz', cref=27.5, power=2, window_type='none', rollon_thresh=0.05)

This function calculates the spectral centroid and spectral spread of an audio array.

Parameters:
  • audio – Audio array

  • fs – Sample rate of audio file

  • lf_limit – Low frequency limit, in Hz, to be analysed. Defaults to 20Hz.

  • scale – The frequency scale that calculations should be made over. if no argument is given, this defaults to ‘hz’, representing a linear frequency scale. Options are ‘hz’, ‘mel’, ‘erb’, or ‘cents’.

  • cref – The reference frequency for calculating cents. Defaults to 27.5Hz.

  • power – The power to raise devaition from specteal centroid, defaults to 2.

Returns:

Returns the spectral centroid, spectral spread, and unitless centroid.