0
$\begingroup$

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?

$\endgroup$
4
  • $\begingroup$ The article is mostly about PDM. You are working with PCM, right? If yes then it's easy (assuming you trust microphone manufacturers regarding what they put in specsheets). Just calculate the RMS in dBFS scale, find what is the sensitivity (i.e. -26 dBFS) which corresponds to 94 dB SPL. Then calculate maximum SPL (120 in this case) and add it to your RMS level. $\endgroup$ – jojek Jul 23 '20 at 17:18
  • $\begingroup$ I just noticed you tagged this question as ultrasound. Do you want to measure frequencies above 20kHz? $\endgroup$ – jojek Jul 23 '20 at 19:21
  • 1
    $\begingroup$ This same question was already posted on ee.se. $\endgroup$ – Justme Jul 23 '20 at 21:30
  • $\begingroup$ I am working with frequencies above 20 kHz and the article discusses the conversion of PDM to PCM before doing a linear conversion to dB SPL. $\endgroup$ – dg1271 Jul 27 '20 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.