A sound level meter or sound meter is an instrument which measures sound pressure level. Sound pressure level (SPL) or sound level is a logarithmic measure of the effective sound pressure of a sound relative to a reference value. It is measured in decibels (dB) above a standard reference level. The commonly used reference sound pressure in air is = 20 µPa (rms) which is usually considered the threshold of human hearing. Keep in mind that 1 pascal will equal an SPL of 94 dB. Because the frequency response of human hearing changes with amplitude, a weighting have been established for measuring sound pressure. Usually the A-weighting curve is used. A weighting curve is a graph of gain across the frequency range (10Hz to 20kHz).
SPL level is defined as
given p_rms as the sound pressure measured, and p_ref as the reference sound pressure.
Once we have got the RMS value of the signal (actualRMS), we can transform it to SPLdb using this formula:
given refRMS as the reference RMS value for the input board at a know refSPLdb SPLdb level.
To compute SPL measurements, the meters loop is:
- collects N samples
- do FFT for the N samples collected, the signal is now transformed in the frequency domain
- apply A-weighting (in freq domain)
- get magnitude of the signal
- get RMS value of the signal
- apply a time-weight filter to RMS value
- compute the SPL using the RMS value
- output data
Every sample is collected at a fixed time, a timer interrupt impose this timing, this is because we need to know the sampler frequency, to built filters and output signal magnitude.
Runnig @16Mhz i’m able to collect samples at almost 22050Hz.
For FFT i’ve used Radix-4 FFT library you can find it here http://davidegironi.blogspot.it/2013/06/avr-atmega-audio-input-rma-using-fft.html.
The method to weighting the signal proposed here just use a weight table that contains the weight of the signal in the frequency domain, this table shoud be FFT size/2, because we can retain frequencies below Nyquist rate.
For more detail: A simple Sound Pressure Level Meter (SPL) dB audio meter using AVR ATmega