maad.features.all_temporal_alpha_indices

maad.features.all_temporal_alpha_indices(s, fs, verbose=False, display=False, **kwargs)[source]

Compute 16 temporal domain acoustic indices.

Parameters:
s1D array

Audio to process (wav)

fsfloat

Sampling frequency of the audio (Hz)

verboseboolean, default is False

print indices on the default terminal

displayboolean, default is False

Display graphs

kwargsarguments for functions:
  • temporal_leq(s, fs, gain, Vadc, sensitivity, dBref, dt)

  • temporal_snr(s, mode, Nt)

  • temporal_median(s, mode, Nt)

  • temporal_entropy(s, compatibility, mode, Nt)

  • temporal_activity (s,dB_threshold, mode, Nt)

  • temporal_events (s, fs, dB_threshold, rejectDuration, mode, Nt,display)

For envelope

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.

For entropy

compatibilitystring {‘QUT’, ‘seewave’}, default is ‘QUT’

Select the way to compute the temporal entropy.

  • QUT : entropy of the envelope²

  • seewave : entropy of the envelope

For LEQt calculation

gaininteger

Total gain applied to the sound (preamplifer + amplifier)

Vadcscalar, optional, default is 2Vpp (=>+/-1V)

Maximal voltage (peak to peak) converted by the analog to digital convertor ADC

sensitivityfloat, optional, default is -35 (dB/V)

Sensitivity of the microphone

dBrefinteger, optional, default is 94 (dBSPL)

Pressure sound level used for the calibration of the microphone (usually 94dB, sometimes 114dB)

dtfloat, optional, default is 1 (second)

Integration step to compute the Leq (Equivalent Continuous Sound level)

For audio activity and events

dB_thresholdscalar, optional, default is 3dB

data >Threshold is considered to be an event if the length is > rejectLength

rejectDurationscalar, optional, default is None

event shorter than rejectDuration are discarded duration is in s

Returns:
df_temporal_indices: Pandas dataframe

Dataframe containing of the calculated audio indices : ZCR, MEANt, VARt, SKEWt, KURTt, LEQt, BGNt, SNRt, MED, Ht, ACTtFraction, ACTtCount, ACTtMean, EVNtFraction, EVNtMean, EVNtCount

Examples

>>> import maad
>>> s, fs = maad.sound.load('../data/cold_forest_night.wav')
>>> df_temporal_indices_NIGHT = maad.features.all_temporal_alpha_indices (s,fs)
>>> s, fs = maad.sound.load('../data/cold_forest_daylight.wav')
>>> df_temporal_indices_DAY = maad.features.all_temporal_alpha_indices (s,fs)

Variation between night and day

>>> variation = abs(df_temporal_indices_DAY - df_temporal_indices_NIGHT)/df_temporal_indices_NIGHT*100
>>> print('LEQt variation night vs day: %2.2f %%' % variation['LEQt'][0]) 
LEQt variation night vs day: 29.66 %
>>> print('Ht variation night vs day: %2.2f %%' % variation.Ht.iloc[0]) 
Ht variation night vs day: 2.33 %
>>> print('MEANt variation night vs day: %2.2f %%' % variation['MEANt'][0]) 
MEANt variation night vs day: 299.62 %
>>> print('VARt variation night vs day: %2.2f %%' % variation['VARt'][0]) 
VARt variation night vs day: 1664.02 %
>>> print('EVNtFraction variation night vs day: %2.2f %%' % variation['EVNtFraction'][0]) 
EVNtFraction variation night vs day: 98.48 %