SPL will be calculated as described below:

  1. collect $N$ samples
  2. do FFT for the $N$ samples collected: the signal is now in the frequency domain.
  3. get magnitude of the FFT
  4. get RMS value of the FFT
  5. apply a time-weight filter to the RMS value
  6. apply a frequency-weight filter to the RMS value
  7. compute the SPL using the RMS value
  8. output data

Using variable as described below:

  • $N = 65536$
  • Sampling rate: 48KHz
  • calculate cycle: 0.5sec

In some documents, the method of adding time weights uses exponential moving averages:

$$y = \alpha y + (1 - α)y_{new}$$

What does $\alpha$ mean? How to add time weights in SPL operation?

  • $\begingroup$ The time weightings Fast (0.125s) and Slow (1s) are done by using Exponential Weighted Moving Average. Basically, you don't want your SPL reading to jump around a lot. In analog domain this would be a simple RC low pass filter with a cut-off frequency $f_0=\frac{1}{2\pi\tau}$. In digital domain you would use an EWMA filter: $L_{N+i} = L_N e^{-i\cdot dt/\tau}$, where $\tau$ is your time constant and $dt$ is a sampling period. $\endgroup$
    – jojeck
    Aug 10, 2022 at 18:31

1 Answer 1


There are few things to consider here

  • After step 1 you probably want to apply a window (hanning, for example)
  • The choice or parameters is odd. The FFT is quite long with an FFT resolution of less than 1 Hz and an overlap of 63%. More common would be N = 8192 or N = 16384 with 50% overlap.
  • You need to apply the frequency weighting before calculating the RMS.
  • The whole thing will need to be calibrated. This depends on microphone sensitivity, pre-amp gain, ADC sensitivity, any OS-based preprocessing, choice window, etc. If you run it always on the same hardware, it's easiest to calibrate against a "known good" SPL meter.

What does α mean?

The operation is a low pass filter. It determines how quickly the meter will react to changes in the physical SPL. It's a trade-off between being able follow quick events but not be so jittery that it's hard to read.

$\alpha$ determines the cutoff frequency and/or time constant of that lowpass filter. Depending on your application these may be prescribed in the standard IEC 61672-1. See for example https://www.nti-audio.com/en/support/know-how/fast-slow-impulse-time-weighting-what-do-they-mean

The relationship between $\alpha$ depends on the desired time constant and your "cycle rate".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.