# Measuring microphone Signal to Noise ratio (SNR) with A-weighting

Foreword: I have already read Applying A-weighting and user @endolith's A-weighting code

I would like to measure the SNR of a microphone with the same method applied by the main manufacturers, that is displayed in their datasheets (example here with Neumann's U87 technical spec):

Here is how I plan to do it:

1. Play a continuous 1 kHz sine signal with a studio monitor loudspeaker (ideally in an anechoic room)

2. Adjust the playback volume such that the measured volume, close to the microphone, is 94 dB SPL, by using a sound level SPL meter device

Question here: should it be 94 dB SPL RMS or peak? (For a sine there's a difference of ~ 3 dB between RMS and peak)

3. Record the audio signal with a digital audio interface

4. Stop the playback of the sine and also record some silence (and thus some microphone noise: that is precisely what we want to measure!)

5. Normalize the recorded WAV file to 0 dB FS (so this will take the peak of the signal in consideration)

Is this step correct? It seems that a normalization is required here; if no normalization is done, the result SNR would depend on the preamp input gain!

6. Apply the A-weighting or CCIR-weighting (also called ITU-R 468 weighting), for example with endolith's code here

7. Compute the RMS of the A-weighted signal, during the silence/noise-only part.
This will be the final "Signal-to-noise ratio, A-weighted (re. 94 dB SPL) of the microphone".

Is this correct?

Here is a WAV file I recorded with the method described here. I'm curious to find how to find the A-weighted SNR of this microphone.

• In your setup, some of the noise will come from the preamp. How significant it is depends on the preamp specs. – audionuma Oct 12 '18 at 4:58
• @audionuma I checked this in the specs, and the preamp+ADC noise seems to be $\ll$ mic noise (confirmed by tests: maybe ~20 dB quieter than mic noise). – Basj Oct 12 '18 at 6:46

IEC 801-21-20 Defines sound pressure as the RMS of of the instantaneous pressure, and as far as I know all meters use RMS. The problem you have in your implementation is that you are normalizing the peak value of the active region but measuring the RMS of the inactive part. As you described, for sine waves the RMS is 3dB less than the peak. You could take the Difference between the RMS in the active to the inactive regions. Or you could assume that the active RMS is -3dB and use that instead. Otherwise you should be good to go.

• You're right, I should just take the difference between RMS of active region (~ -3dB, since it's a sine that has a peak at 0 dB) and RMS of noise region. – Basj Oct 12 '18 at 14:06

Now that I have done many tests, I'll share how I finally did it:

1. Play a continuous 1 kHz sine signal with a studio monitor loudspeaker

2. Adjust the playback volume such that the measured volume, close to the microphone, is 94 dB SPL, by using a sound level SPL meter. Useful tips:

• the SPL meter should be close to the loudspeaker (then we have consistent measurements if we repeat them), if too far the measurements are inconsistent

• the person who does the measurements should not be/move close to the mic/SPL meter/loudspeaker, not because of the noise he produces, but more because of the reflection "wall" he creates in the room (when moving close to the loudspeaker and then moving away, I noticed the recorded 1k sine has not a flat envelope! When standing far from the mic/SPL meter/loudspeaker, it does have a flat envelope, as desired)

• More generally, the dB SPL measurement is rather dependent of the position/angle between the SPL meter and the loudspeaker, and idem for the microphone: turning the microphone or SPL meter facing the loudspeaker of a few degrees will change the measured level of a few dB (example: it can change from 94 dB to 91 dB), so it is required to not move the microphone/SPL meter/loudspeaker during the recording session.
Sidenote: some people use such expensive calibration tools that produce a 94 dB SPL 1Khz sine, in which you insert the microphone; this probably avoids the loudspeaker and microphone orientation problems.

3. Record the audio signal with a digital audio interface (if you're using a laptop, unplug the AC adapter and power it from battery, to avoid the typical 50 Hz noise and other power supply noises)

4. Stop the playback of the sine and also record some silence (and thus some microphone noise: that is precisely what we want to measure!). Tip: power off the loudspeaker to avoid recording the quiet "shhhhh" noise of the loudspeaker

5. Apply the A-weighting or CCIR-weighting (also called ITU-R 468 weighting), for example with endolith's code here

6. Now compute :

• the dB RMS of the A-weighted signal, during the silence/noise-only part
• the dB RMS of the A-weighted signal, during the sine part

Subtract both numbers, this will be the final "Signal-to-noise ratio, A-weighted (re. 94 dB SPL) of the microphone".

• "My" code (which I just translated from someone else's) is not accurate at high frequencies, so probably shouldn't use it. I did a more accurate version with the MZTi but apparently I haven't pushed it to github yet :| – endolith Oct 25 '18 at 20:56
• @endolith: this is the freqz of your (translated) code: frequency response, I think it's really good, except maybe 15k to 20k but not much energy there anyway, so it would change maybe 0.1 dB in the final SNR. I liked your v1.0 of Aweighting because it did not require any external library, and it provided b, a that can be directly fed to lfilter(b, a, x). IIRC in your newer version it was more complicated, and did not give b, a for lfilter, that's why I kept your v1.0 ;) – Basj Oct 25 '18 at 21:04
• Yes, around 20k is the problem area, due to BLT. I will try to write the improved version in the same simple-to-use way. But you should not use lfilter for any higher-order filter anyway, use sosfilt instead. – endolith Oct 25 '18 at 21:40