maad.spl.amplitude2dBSPL

maad.spl.amplitude2dBSPL(s, gain, Vadc=2, sensitivity=-35, dBref=94, pRef=2e-05)[source]

Convert signal (amplitude) to instantaneous sound pressure level (L [dB SPL]).

Parameters:
sndarray-like or scalar

s is an amplitude signal (not energy signal : s² )

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)

pRefSound pressure reference in the medium (air:20e-6 Pa, water:1e-6 Pa)
Returns:
Lndarray-like or scalar

ndarray-like or scalar containing the sound waveform in dB SPL (Sound Pressure level in dB)

See also

power2dBSPL

Examples

>>> import numpy as np
>>> w, fs = maad.sound.load('../data/cold_forest_daylight.wav') 
>>> Sxx_amplitude,tn,fn,_ = maad.sound.spectrogram (w, fs, nperseg=1024, mode='amplitude')  
>>> S_amplitude_mean = np.mean(Sxx_amplitude, axis=1)

Get instantaneous sound pressure level (L).

>>> maad.spl.amplitude2dBSPL(S_amplitude_mean, gain=42)    
array([39.56422048, 44.37117437, 41.95705677, 39.60547011, 36.43237323,
       33.24966066, 31.44139953, 30.4473799 , 28.91589639, 27.26962076,
       26.7722199 , 26.27328293, 25.69373328, 24.73880674, 23.85828781,
       ...
       -6.30767022, -6.46481481, -6.49907112, -6.52754376, -6.52476444,
       -6.73617834, -6.75685948])