I've got a set with MEMS microphones that measure audio signals at ultrasonic frequencies. The MEMS microphones have a PDM output which is then converted into PCM (this is necessary to allow for a microcontroller to do certain processing on the sampled audio data).

I'm trying to come up with a method to convert the PCM samples into dB SPL and the best resource I've found on this is this link: https://curiouser.cheshireeng.com/2015/01/16/pdm-in-a-tiny-cpu/. I understand how they calculate a RMS value from 977 PCM samples (this is called an SPL value in internal logarithmic units in the article). They relate this RMS value to a dB FS value by using the microphone datasheet (where the maximum possible PCM value/RMS value for a square wave will be equivalent to a known maximum value of dB FS of +3 dB FS ). I don't understand how the author then creates a linear relationship between dB FS and dB SPL (akin to the classic y=mx+b). The specific paragraph from the article discussing this is listed below:

To relate the finished SPL value in internal logarithmic units to dB SPL, we have to note that the microphone data sheet claims that a 1 kHz tone at 94 dB SPL will typically register as -26 dB FS, where 0 dB FS is largest amplitude sine wave that can be represented in a PCM sample without clipping. A full scale square wave is then +3 dB FS, and which would measure as 8 * log2(8192) or 104 which can be rescaled to dB by multiplying by 20 * log10(2) / 8 or about 0.75 to get 78. Subtract the 3 dB for a sine wave, and we find that the offset is about -75 dB to dB FS, or +19 to dB SPL.

Putting this all together, if we wanted to output true db SPL we would need the following expression in terms of our computed variable spl: dB SPL = (3 * spl / 4) + 19

I'm not understanding how the coefficient of 0.75 or the intercept of +19 is justified. Does anyone have any ideas or some additional resources I can consult on this?


1 Answer 1


You need to know what kind of sound pressure values in SPL causes what kind of PCM values. Only then you can calculate the reverse, i.e. what kind of PCM values are in SPL. If the microphone datasheet gives info how SPL gets converted to PDM stream and you know how the PDM is converted to PCM then you should know the relation. Otherwise you need to figure it out by for example calibrating it with know test tone.

Just to give another example, in analog domain, the microphone would state the sensitivity, i.e. what SPL test tone outputs a given voltage. Then when you use ADC to get PCM, you know what PCM amplitude means in voltage, so you also know what that voltage means in SPL. In your case, the analog signal is replaced with PDM and the ADC is replaced by the PDM to PCM converter.

  • \$\begingroup\$ So my MEMS microphone's datasheet has a sensitivity value of -26 dB FS (94 dB SPL @ 1 kHz) and I know that the acoustic overload point is 120 dB SPL (which is equal to 0 dB FS). If I know the max PCM value, I know this would equal 0 dB FS or 120 dB SPL. If at -26 dB FS (94 dB SPL @ 1 kHz), the SNR is 64, the PCM values cover a dB FS range of 0 dB FS to -90 dB FS. If all that is true, would I not be able to then calculate the difference between PCM values at 2 known dB FS/dB SPL sets of values (94 dB SPL/-26 dB FS and 120 dB SPL/0 db FS) and use that to interpolate for other values of dB SPL? \$\endgroup\$
    – dg1271
    Jul 22, 2020 at 14:22
  • \$\begingroup\$ A change of X dB is change of X dB, whether it is dB SPL or dB FS. You just need to find the reference, i e. which dB FS equals which dB SPL. \$\endgroup\$
    – Justme
    Jul 23, 2020 at 21:34

Your Answer

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

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