# Calculating Sound Pressure Level from FFT

R

#### Robert Scott

In a test cell for diesel engines I am sampling audio from a high-quality industrial microphone and performing an FFT, from which I hope to extract an "A-weighted" sound pressure level in dB comparable to a commercial dosimeter to measure how loud the engine is. I am unsure about the algorithm. This is what I have done so far:
1. FFT of the microphone data is in frequency bins of complex numbers up to the Nyquist frequency.
2. I multiply each complex number by the A-weighting scaling factor. This is supposed to represent the characteristics of the human ear:<pre>(12200^2 * f^4) / ((f^2+20.6^2) * (f^2+12200^2) * (f^2+107.7^2)^0.5 * (f^2+737.9^2)^0.5))</pre> where f is the bin frequency in Hz.

3. I add up the magnitude squared of the resulting complex numbers (real^2 + imag^2).

4. I divide the sum in (3) by the number of bins up to the Nyquist frequency (so that I get the average of the magnitude squared of all the complex numbers in (2).

5. I take the logarithm base 10 of the average from (4) and multiply by 20 and call this a dB level.

6. I add a fixed dB offset determined by my gold standard calibration against a good dosimeter so the result agrees with the dosimeter.

My question is do I have the algorithm right? I am not sure about using the magnitude squared instead of taking the square root. Am I applying the A-weighting formula in the right place? Once I establish the offset will my algorithm continue to agree with the dosimeter as the amplitude and frequency distribution changes? I am assuming that both units have comparable microphone and signal conditioning response.