Feature request - A-weighting and exponential averaging to compute_level
Hi there
I've just started using this package and it works nicely. Would others find it useful to be able to plot the sound pressure level, as an A-weighted value, and to apply a (typically 125ms) RMS filter? I was thinking to just add some extra params to the compute_level with defaults to maintain the current behaviour:
compute_level(nb_points=1000,start=0.5,stop=9.5, weight='linear',tau=0)
Example code to A weight in the time domain using the filter function and the generated coefficients.
` class AWeightingFilter(object):
def __init__(self, fs):
self.fs = fs
self.f1 = 20.598997
self.f2 = 107.65265
self.f3 = 737.86223
self.f4 = 12194.217
self.A1000 = 1.9997
def coefficients(self):
num = [((2*np.pi*self.f4)**2)*(10**(self.A1000/20)), 0, 0, 0, 0]
den = np.convolve(
[1, 4*np.pi*self.f4, (2*np.pi*self.f4)**2],
[1, 4*np.pi*self.f1, (2*np.pi*self.f1)**2])
den = np.convolve(
np.convolve(den, [1, 2*np.pi*self.f3]),
[1, 2*np.pi*self.f2])
return bilinear(num, den, self.fs)
`
Hi, I'm happy you ask for this feature. We have currrently one student from the University Rey Juan Carlos in Madrid working to implement some sound level meter functions in the project. You can follow his work in his fork of Mosqito (https://github.com/Igarciac117/MoSQITo). His work should be merged to the project by this summer.
Thanks. Can you please pass my contact details to Juan? [email protected]