maad.spl.pressure2dBSPL

maad.spl.pressure2dBSPL(p, pRef=2e-05)[source]

Convert sound pressure (p [Pa]) to sound pressure level (L [dB]).

Parameters:
pndarray-like or scalar

Array or scalar containing the sound pressure in Pa

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

Array or scalar containing the sound pressure level (L [dB])

Examples

>>> w, fs = maad.sound.load('../data/cold_forest_daylight.wav') 
>>> p = maad.spl.wav2pressure(wave=w, gain=42)

Get instantaneous sound pressure level (L)

>>> maad.spl.pressure2dBSPL(abs(p))
    array([47.63116868, 49.16046498, 49.20160951, ..., 39.32747759,
    33.79115165, 38.52380598])

Get equivalent sound pressure level (Leq) from the RMS of the pressure signal

>>> p_rms = maad.util.rms(p)
>>> maad.spl.pressure2dBSPL(p_rms)  
    48.51429086346293