maad.spl.wav2dBSPL
- maad.spl.wav2dBSPL(wave, gain, Vadc=2, sensitivity=-35, dBref=94, pRef=2e-05)[source]
Convert wave amplitude to instantaneous sound pressure level (L [dB SPL]).
Warning
- Important: Previous versions of this function incorrectly calculated the
pressure conversion by omitting the division by 2 for the Vadc parameter. In dB SPL, this would lead to a 6 dB increase in the calculated sound pressure level. If you want to correct the SPL values obtained with the previous version, you can simply subtract 6 dB from the old results. This has been corrected in the version 1.5.1. Ensure you are using the latest version (>=1.5.1) to obtain accurate dB SPL values.
- Parameters:
- wavendarray-like or scalar
wave should already be normalized between -1 to 1 (depending on the number of bits) take the output of the function sound.load of maad module ndarray-like or scalar containing the raw sound waveform
- 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)
Examples
>>> w, fs = maad.sound.load('../data/cold_forest_daylight.wav') >>> L = maad.spl.wav2dBSPL(wave=w, gain=42)
Get an approximate of the equivalent sound pressure level (Leq)
>>> maad.util.mean_dB(L) 48.51429086346294
Get equivalent sound pressure level (Leq) from the dedicated function
>>> Leq = maad.spl.wav2leq(w, fs, gain=42, dt=1) >>> Leq_mean = maad.util.mean_dB(Leq) >>> Leq_mean 48.55488267086038