maad.sound.temporal_snr

maad.sound.temporal_snr(s, mode='fast', Nt=512)[source]

Compute the signal to noise ratio (SNR) of an audio signal in the time domain.

Parameters:
s1D array

Audio to process

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:
ENRtfloat

Total energy in dB computed in the time domain

BGNtfloat

Estimation of the background energy (dB) computed in the time domain

SNRt: float

Signal to noise ratio (dB) computed in the time domain SNRt = ENRt - BGNt

References

[1]

Towsey, Michael (2013), Noise Removal from Waveforms and Spectrograms Derived from Natural Recordings of the Environment. Queensland University of Technology, Brisbane.

[2]

Towsey, Michael (2017),The calculation of acoustic indices derived from long-duration recordings of the naturalenvironment. Queensland University of Technology, Brisbane.

Examples

>>> s, fs = maad.sound.load('../data/rock_savanna.wav')
>>> _,_,snr = maad.sound.temporal_snr(s)
>>> snr
1.5744987447774665