soundscapecode.rms_spl
- soundscapecode.rms_spl(data: ndarray, fs: int, reference_sound_pressure: int = 1) float
Calculates the root-mean-squared sound pressure level for sound data.
Parameters
- data: np.ndarray
an array-like with shape (n, 1)
- fs: int
the sampling frequency
- reference_sound_pressure:int
p_0 in uPa, defaults to 1
Returns
- float
the RMS SPL
Raises
- AttributeError
if either data input is not a vector
Examples
>>> import numpy as np >>> np.random.seed(0) >>> import soundscapecode as ssc >>> fs = 48000 >>> sound = np.random.rand(fs*60,1) >>> ssc.rms_spl(sound, fs) -4.770500024074682