soundscapecode.max_spl

soundscapecode.max_spl(data: ndarray, reference_sound_pressure: int = 1) float

Calculates the maximum instantaneous sound pressure level for sound data.

Parameters

data: np.ndarray

an array-like with shape (n, 1)

reference_sound_pressure: int

p_0 in uPa, defaults to 1

Returns

float

The maximum instantaneous 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.max_spl(sound, fs)
-46.8124147991551