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([53.65176859, 55.18106489, 55.22220942, ..., 45.3480775 , 39.81175156, 44.54440589])
Get equivalent sound pressure level (Leq) from the RMS of the pressure signal
>>> p_rms = maad.util.rms(p) >>> maad.spl.pressure2dBSPL(p_rms) 54.53489077674256