I have a streaming audio signal that I am recording in real time. To make the explanation easy, say the signal that I receive is calibrated and has a sampling frequency, $F_s = 44100\textrm{ Hz}$.
I am then finding the Sound Pressure Level of this signal. For this purpose, I get a frame of audio data of t seconds.
Then, RMS Sound Pressure Level (dB) is given by: $$ \rm Amplitude_{RMS} = \sqrt{mean\left(frame ^2\right)} $$
This gives the instantaneous RMS of a $t$-second frame of audio. Then, to find a $\textrm{ dB}$ level, $$ L_p = 20\log_{10}\left(\rm Amplitude_{RMS}\right) $$
Things get tricky here with the definitions of 'Fast' or 'Slow' sound pressure level. As this post points out, for time-weighted exponential average, I created a low-pass filter with a real pole at $1/\tau$ (where $\tau= 125\textrm{ ms}$ for 'fast' or $1\textrm{ s}$ for 'slow')
τ = 0.125; %fast
[b a] = bilinear(1, [1 1/τ], Fs);
frame_filtered = filter(b, a, frame.^2);
L_fast = 20*log10(sqrt(mean(frame_filtered)));
The IEC 61672 specifies the time weightings to be Fast and Slow for determining the speed at which the instrument responds to changing noise levels.
- How does this work for digital audio?
- Does it mean that the analysis needs to be performed on a fixed frame of data?
For this particular example, this frame would be $t\cdot F_s$ samples?
Slow: 1*44100 = 441000 samples Fast: 0.125*44100 ~= 5513 samples
If so, is it true that I would need to know in advance whether I need fast or slow levels?