maad.features.temporal_activity

maad.features.temporal_activity(s, dB_threshold=3, mode='fast', Nt=512)[source]

Compute the acoustic activity index in temporal domain.

Acoustic activity corresponds to the portion of the waveform above a threshold [1] [2]

Three values are computed with this function:

  • ACTfract : proportion (fraction) of points above the threshold

  • ACTcount : number of points above the threshold

  • ACTmean : mean value (in dB) of the portion of the signal above the threhold

Parameters:
s1D array of floats

audio to process (wav)

dB_thresholdscalar, optional, default is 3dB

data >Threshold is considered to be an activity

modestr, optional, default is “fast”

Select the mode to compute the envelope of the audio waveform

  • “fast”The sound is first divided into frames (2d) using the

    function _wave2timeframes(s), then the max of each frame gives a good approximation of the envelope.

  • “Hilbert”estimation of the envelope from the Hilbert transform.

    The method is slow

Ntinteger, optional, default is 512

Size of each frame. The largest, the highest is the approximation.

Returns:
ACTfract :ndarray of scalars

proportion (fraction) of points above the threshold for each frequency bin

ACTcount: ndarray of scalars

number of points above the threshold for each frequency bin

ACTmean: scalar

mean value (in dB) of the portion of the signal above the threhold

References

[1]

Towsey, Michael (2013), Noise Removal from Waveforms and Spectrograms Derived from Natural Recordings of the Environment. Queensland University of Technology, Brisbane. https://eprints.qut.edu.au/61399/4/61399.pdf

[2]

QUT : https://github.com/QutEcoacoustics/audio-analysis. Michael Towsey, Anthony Truskinger, Mark Cottman-Fields, & Paul Roe. (2018, March 5). Ecoacoustics Audio Analysis Software v18.03.0.41 (Version v18.03.0.41). Zenodo. http://doi.org/10.5281/zenodo.1188744

Examples

>>> import maad
>>> s, fs = maad.sound.load('../data/spinetail.wav')
>>> ACTfract, ACTcount, ACTmean = maad.features.temporal_activity (s, 6)
>>> print('ACTfract: %2.2f / ACTcount: %2.0f / ACTmean: %2.2f' % (ACTfract, ACTcount, ACTmean)) 
ACTfract: 0.37 / ACTcount: 620 / ACTmean: 24.41