I am having a digital Mic which gives me PCM output on I2S. I want to convert this PCM value into dB (SPL value). Can anyone tell me the procedure? The sensitivity of the mic is -26 dBFS.
With analog mics I think it is clear to me as the sensitivity is provided in mV/Pa. So I can directly convert the RMS Voltage value into Pascals and convert it into dB. I am getting somewhat confused with digital mics.
Please tell the steps involved in the algorithm.
Although this is not my area of expertise, I will wade into the discussion.
Based on the datasheet and what I have read here gearslutz_link_1of2 and here gearslutz_link_2of2, it appears there is no easy way to derive a closed-form equation to convert between dB SPL and dBFS. It must be done by establishing a relationship between the dB SPL level and the resulting dBFS value from measurements.
If you look at the datasheet, the sensitivity of your microphone is -26 dBFS (typical value) when a calibrated 1 kHz tone at 94 dB SPL is presented (given the microphone is omnidirectional, this likely means the 1 kHz sound source is located 1 meter from the microphone in a free-field acoustic environment) to the microphone.
As the sound level is increased (a higher dB SPL level), I believe the dBFS value increases towards 0. From what I gather, if the sound level is too high and the dBFS value is 0 then clipping occurs and the fidelity of the sound received by the microphone is degraded by the microphone because it cannot digitally represent that sound level.
Once a calibrated dB SPL level and dBFS value is found, you could then work out how the dBFS value changes with changes in dB SPL level. I think you'd need a calibrated sound level meter to properly determine the working range of your system.
Does this make sense?
It's somewhat late at night for me so I didn't have the patience to make it entirely though this article but I believe it provides the answers you seek:
I was already referring to this article. I know if it is an Analog mic then I can connect to a preamp and adc to get digital values. Then I can calculate the RMS value of the voltage. As I have the mic sensitivity in mV/Pa I can directly convert the RMS Voltage value into equivalent pressure value and calculate pressure levels.
Somehow I am unable to derive the relation between the digital values provided to me by the digital mic to pressure domain. Also the application note states that sensitivity in analog mics is referenced to RMS Voltages and in digital mics is referenced to full scale voltages (I assume this in my case to be 2^18 - 1). So if I follow the same algorithm in this case I don't think it will work.
If you could point us to the datasheet of the mic it would help the reply.
I knew this once, did it all the time but it's been so long away from that field that I can't reconstruct it in the time I have to think about it. Have no fear though, it isn't rocket science and someone will hopefully jog my memory. It wasn't a digtal mic until it ran through my ADC where a voltage could be applied but same problem.
Measurements, like Sound Pressure Level, expressed in dB always depend on their reference value, here p[sub]0. As this wikipedia link shows, the notation "dB SPL" uses the human hearing threshold p0 = 20u[micro]Pa, with 1Pa[Pascal] = 1N[Newton]/m² as the SI unit for pressure.
Accordingly, wikipedia mentions that 1Pa is equivalent to 94dB SPL. Now, the digital mic datasheet tells that sensitivity S = -26dBFS[full scale] , SNR and THD are all specified at this SPL, that is a pressure of 1Pa. Further, the data sheet says "The Data Format is I2S, 24 bit, 2’s compliment [complement], MSB first. The Data Precision is 18 bits, unused bits are zeros." Assuming that "unused bits" are the least significant ones, we have full scale 2^23[-1] = 0dBFS, and 1Pa or -26dBFS is a value of decimal 420426.
Dear @mm2426, pipifax gives a good explanation.
In order to measure absolute acoustic levels, the pressure to voltage conversion must be known (microphone's job). This value is typically named "sensitivity" in acoustics. The 0 dBA (reference in air) is 20µPa RMS.
Typical sensitivy of your microphone is 94dB SPL @ 1khz (+/-3dB) and this value is typically 26 dB lower the full scale (FS). So full scale (FS) of the microphone corresponds to 26dB + 94dB SPL = 120dB SPL.
Assuming FS is 2^23 (20*log10(2^23) = 138 dB FS), the 0dBA reference (20dBµPa) is calculated like that:
0dBA = FS-26dB = 10^((138-26)/20) = 420426
PS: It is right unused bit are LSB (See figure 7 page 7)