TransWikia.com

How to scale audio signal from PCM data to a dB SPL value?

Electrical Engineering Asked by dg1271 on November 23, 2021

0

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?

One Answer

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.

Answered by Justme on November 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP