maad.features.tfsd

maad.features.tfsd(Sxx, fn, tn, flim=(2000, 8000), log=True, mode='thirdOctave', display=False)[source]

Compute the Time frequency derivation index (tfsd) from a spectrogram. [1] [2]

Parameters:
Sxxndarray of floats

matrix : Amplitude spectrogram

fnvector

frequency vector corresponding to the spectrogram

tnvector

time vector corresponding to the spectrogram

flimtupple (fmin, fmax), optional, default is (2000, 8000)

Frequency band used to compute tfsd.

logboolean, optional, default is True

If True, the log of Sxx is taken before calculating the TFSD as it was defined in [1] [2] if False, no log is applied, TFSD > 0.3 indicates the presence of birds

modestring {‘thirdOctave’,’Octave’}, default is thirdOctave

Select the way to transform the spectrogram with linear bands into octave bands

displayboolean, optional, default is False

Display the 1st and 2nd derivation of the spectrogram

Returns:
tfsdscalar

Time frequency derivation index

Notes

The TFSD varies between 0 and 1, where 1 indicates sound events on the full spectrogram. When flim=(2000,8000), TFSD mostly indicates the presence of birds in the signal When flim=(0,1000), TFSD mostly indicates the presence of human voice in the signal When log=False and flim=(2000,8000), a TFSD > 0.3 indicates the presence of birds in the signal

References

[1] (1,2)

Aumond, P., Can, A., De Coensel, B., Botteldooren, D., Ribeiro, C., & Lavandier, C. (2017). Modeling soundscape pleasantness using perceptual assessments and acoustic measurements along paths in urban context. Acta Acustica united with Acustica. DOI: 10.3813/AAA.919073

[2] (1,2)

Gontier, F., Lavandier, C., Aumond, P., Lagrange, M., & Petiot, J. F. (2019). Estimation of the perceived time of presence of sources in urban acoustic environments using deep learning techniques. Acta Acustica united with Acustica.`DOI: 10.3813/AAA.919384 <https://doi.org/10.3813/AAA.919384>`_

Examples

>>> import maad

During the day

>>> s, fs = maad.sound.load('../data/cold_forest_daylight.wav')
>>> Sxx_power,tn,fn,_ = maad.sound.spectrogram(s,fs)
>>> maad.features.tfsd(Sxx_power,fn, tn)  
0.4637352908292768

During the night

>>> s, fs = maad.sound.load('../data/cold_forest_night.wav')
>>> Sxx_power,tn,fn,_ = maad.sound.spectrogram(s,fs)
>>> maad.features.tfsd(Sxx_power,fn, tn)   
0.42435773298811824