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?