maad.features.all_spectral_features

maad.features.all_spectral_features(s, fs, nperseg=1024, roi=None, method='fast', **kwargs)[source]

Compute all the spectral features for a signal.

Parameters:
s1D array

Input audio signal

fsfloat

Sampling frequency of audio signal

npersegint, optional

Length of segment to compute the FFT. The default is 1024.

roipandas.Series, optional

Region of interest where peak frequency will be computed. Series must have a valid input format with index: min_t, min_f, max_t, max_f. The default is None.

method{‘fast’, ‘best’}, optional

Method used to compute the peak frequency. The default is ‘fast’.

kwargsadditional keyword arguments

If window=’hann’, additional keyword arguments to pass to sound.spectrum.

Returns:
spectral_featurespandas DataFrame

DataFrame with all spectral features computed in the spectrum

Examples

>>> from maad import features, sound
>>> s, fs = sound.load('../data/spinetail.wav')

Compute all the spectral features

>>> features.all_spectral_features(s, fs, nperseg=1024, roi=None)
sm           2.276330e-06
sv           8.118042e-11
ss           5.844664e+00
sk           4.048891e+01
freq_05      6.029297e+03
freq_25      6.416895e+03
freq_50      6.632227e+03
freq_75      6.890625e+03
freq_95      9.216211e+03
peak_freq    6.632227e+03
bw_50        4.737305e+02
bw_90        3.186914e+03
dtype: float64