maad.spl.power2dBSPL

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

Convert power (amplitude²) to sound pressure level (L [dB]).

Parameters:
Pndarray-like or scalar

ndarray-like or scalar containing the power signal (P), for instance Sxx_power, the power spectral density (PSD)

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 pressure level (L [dB])

See also

amplitude2dBSPL

Examples

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

Get instantaneous sound pressure level (L).

>>> maad.spl.power2dBSPL(S_power_mean, gain=42)    
array([41.56456034, 45.44257539, 43.17154534, 41.50665519, 38.08392914,
       34.52770543, 32.57142163, 31.68137318, 30.32861314, 28.46111069,
       27.88530431, 27.48595098, 26.96673216, 25.88241843, 24.93524547,
       ...
       -5.24972979, -5.38796789, -5.42812278, -5.47003443, -5.47740917,
       -5.67015921, -5.68214822])