cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate dB from the mems microphone data?

marchalloakbow
Associate II

Hello all.

I would like to ask how to calculate dB from a data recorded by a MEMS microphone.

I currently use the MP34DT04 on the SensorTile Kit. I checked the SensorTile can record sound with the microphone, and store a wav data file in MicroSD.

In the .wav file, there are chunk of data and, of course, there are sound level data. Then, I would like to calculate dB data from the sound level data. How can I calculate?

If the sound level data is 16 bit, the data would be in between -32768 and 32768. Is the digit can be mapped to full scale sensitivity? The sensitivitiy means the parameter in the datasheet. In the case of the MP34DT04, the sensitivity is in the range of -26dB to 120 dB.

I also wonder what the description in the page 6 of the datasheet means. It says "Duty cycle: min = 40% max = 60%". Is it related to the dB calculation?

Please take care yourself first, and looking forward to the answers. 

Thanks in advance. 

Masaru

1 ACCEPTED SOLUTION

Accepted Solutions
marchalloakbow
Associate II

Thank you Eleon, finally I can calculate dB from MEMS Mic. It's to calc 20*LOG10(%FS) and dBFS comes out.

Regards

Masaru

View solution in original post

7 REPLIES 7
Eleon BORLINI
ST Employee

Hi @marchalloakbow​ , please find below my answer to your question. I start focusing on you sentence:

>> In the case of the MP34DT04, the sensitivity is in the range of -26dB to 120 dB.

The two values (-26 and 120) refers to different acoustic levels (see also AN4426 app note):

  • 120 is in dBSPL, meaning that the value refers to 0dBSPL, equals to 20 uPascal, the minimum audible signal from the human ear. 120dBSPL is almost the noise of a close jackhammer, and is the acoustic signal at which the MP34DT04 microphone begins to saturate (equally, its THD is above 10% -fully distorted signal- or the output digital PDM contains almost all '1' bits);
  • -26 dBFS is the microphone sensitivity at 94dBSPL. the FS in the "dBFS expression" is the microphone full scale, i.e. 120dSPL (acoustically) or all'1' PDM. As you know, the conversion formula for the amplitude is dBFS = 20*log(FS). You can think about the analog microphones (MP23ABS1), which sensitivity is expressed in dBV (referring to 1V, which is not quantitatively but conceptually the FS of the microphone). I suggest you to check your .wav file with the free but powerful tool Audacity, which is provided of the dB conversion embedded feature.

Ps: the ducy cycle doesn't affect microphone output sensitivity, because it is only a clock parameter, that is almost 50% for all ST MEMS digital microphones.

Be safe! Regards

marchalloakbow
Associate II

Hi Mr.Eleon.

Thank you for your quick response.

Your reply showed that I had a misunderstanding. What I took it wrong is the difference in sensitivity of an analog and a digital microphones. So, I thought my question could be rewritten as:

"If the sound pressure level of a wav file is 16 bits, does the lowest value and the highest value correspond to -120 to 0 dBFS?"

Is this Yes or No?

Thanks to the AN4426, I understand dBFS like this. The microphone "MP34DT04" which I use has a maximum level of 120dBSPL and a 64dB SNR. Therefore, the residual noise line in dBSPL is 30 dB(=94 dB - 64dB). Expressing this line dB in dBFS results in -90 dB.

What I want to know is, whether the 16-bit sound pressure level in the wav file corresponds to dBFS or not.

Thanks in advance again.

Masaru.

Eleon BORLINI
ST Employee

Hi Mr. Masaru,

>>"If the sound pressure level of a wav file is 16 bits, does the lowest value and the highest value correspond to -120 to 0 dBFS?"

Basically yes, but in linear scale: the Full Scale will be when the data value is h7FFF (on 16 bits, in two's complement). This is theoretically equivalent to 0 dBFS. The lower values are basically the 20*log(%FS/FS), or equivalently re-scaled for the 0dBFS factor. Moreover, there shouldn't be further software scale factors in the acquisition chain. So the 16bit data is the linear value of the multibit PCM (pulse code modulation) obtained by the PDM (the microphone output) decimation. This decimation depends on the mic clock (usually about 2.4MHz) and the down-sampling factor (usually about x32), resulting in a word length, or acquisition frequency, of 75kHz.

>> Therefore, the residual noise line in dBSPL is 30 dB(=94 dB - 64dB)

You are right, this parameter is called Equivalent Noise Input (EIN)

Regards

marchalloakbow
Associate II

Hello Mr.Eleon.

Thank you for your explanation. Now I understand that the FS of the data is theoretically equal to 0dBFS. And, 

>>the 16bit data is the linear value of the multibit PCM (pulse code modulation) obtained by the PDM (the microphone output) decimation. 

this is what I would like to confirm. So I think my question almost has been answered.

But I could not get the meaning of the lower value explanation. the point I didn't get is 

>>The lower values are basically the 20*log(%FS/FS), or equivalently re-scaled for the 0dBFS factor.

In the sentence, what log(%FS/FS) means? 

I should refer to some study for further understanding. Is it possible for you to recommend me any application notes or articles which describes such detail?

Regards

Masaru

Hi Masaru, the %FS is basically the PCM value with respect to the Full Scale (in Audacity, Full Scale is between +-1 and the signal is a percentage of this full scale, a value <1, except from the spikes that are clipped to 1). I suggest you the Audio Precision website, especially the section dedicated to the PDM to PCM conversion and MEMS microphones, and of course the ST site resources on MEMS microphones (tech notes, presentations). Regards

marchalloakbow
Associate II

Thank you Eleon, finally I can calculate dB from MEMS Mic. It's to calc 20*LOG10(%FS) and dBFS comes out.

Regards

Masaru

Hi Masaru,

that of course... 😉 I was focusing on a programming issue...

-Eleon