audiosegment.py
def spl(self):
        """
        Sound Pressure Level - defined as 20 * log10(p/p0),
        where p is the RMS of the sound wave in Pascals and p0 is
        20 micro Pascals.

        Since we would need to know calibration information about the
        microphone used to record the sound in order to transform
        the PCM values of this audiosegment into Pascals, we can't really
        give an accurate SPL measurement.

        However, we can give a reasonable guess that can certainly be used
        to compare two sounds taken from the same microphone set up.

        Be wary about using this to compare sounds taken under different recording
        conditions however, except as a simple approximation.

        Returns a scalar float representing the dB SPL of this audiosegment.
        """
        arr = self.to_numpy_array()
        if len(arr) == 0:
            return 0.0
        else:
            rms = self.rms
            ratio = rms / P_REF_PCM
            return 20.0 * np.log10(ratio + 1E-9)
def spl(self):
        """
        Sound Pressure Level - defined as 20 * log10(p/p0),
        where p is the RMS of the sound wave in Pascals and p0 is
        20 micro Pascals.

        Since we would need to know calibration information about the
        microphone used to record the sound in order to transform
        the PCM values of this audiosegment into Pascals, we can't really
        give an accurate SPL measurement.

        However, we can give a reasonable guess that can certainly be used
        to compare two sounds taken from the same microphone set up.

        Be wary about using this to compare sounds taken under different recording
        conditions however, except as a simple approximation.

        Returns a scalar float representing the dB SPL of this audiosegment.
        """
        arr = self.to_numpy_array()
        if len(arr) == 0:
            return 0.0
        else:
            rms = self.rms
            ratio = rms / P_REF_PCM
            return 20.0 * np.log10(ratio + 1E-9)
def spl ( self ) : arr = self . to_numpy_array ( ) if len ( arr ) == 0 : return 0.0 else : rms = self . rms ratio = rms / P_REF_PCM return 20.0 * np . log10 ( ratio + 1E-9 )
Sound Pressure Level - defined as 20 * log10(p/p0),
        where p is the RMS of the sound wave in Pascals and p0 is
        20 micro Pascals.

        Since we would need to know calibration information about the
        microphone used to record the sound in order to transform
        the PCM values of this audiosegment into Pascals, we can't really
        give an accurate SPL measurement.

        However, we can give a reasonable guess that can certainly be used
        to compare two sounds taken from the same microphone set up.

        Be wary about using this to compare sounds taken under different recording
        conditions however, except as a simple approximation.

        Returns a scalar float representing the dB SPL of this audiosegment.
Sound Pressure Level - defined as 20 * log10 ( p / p0 ) where p is the RMS of the sound wave in Pascals and p0 is 20 micro Pascals .