maad.features.zero_crossing_rate

maad.features.zero_crossing_rate(s, fs, roi=None)[source]

Compute the zero crossing rate feature of an audio signal.

The zero-crossing rate is the rate of sign-changes along a signal, i.e., the rate at which the signal changes from positive to zero to negative or from negative to zero to positive. This feature has been used widely in speech recognition and music information retrieval, being a key feature to classify percussive sounds [1].

Parameters:
s1D array

Audio to process (wav)

fsfloat

Sampling frequency of audio signal

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.

Returns:
zcrfloat

number of zero crossing /s

References

Examples

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