cancel
Showing results for 
Search instead for 
Did you mean: 

Hello all, 1)How to calculate the dB SPL for a MEMS mic captured PCM values in a log file .?? What are the in particular parameters of the mic ics43432 ? 2)How do we add the acoustic_dB library to a STM32f4xx ?

SG.4
Associate II

My second question continues to be the how can this PCM value be converted to .wav format?

i still need a deeper understanding into this domain , anybody over here can post suggestions ,links technical articles and can share their experiences for my learning would be really be appreciated .

Take care all

Thanks in advance.

Kind Regards

--

Shweta

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Shweta,

hope you are staying safe as well too

>> Can we capture/acquire PCM audio samples upto minimum 5000 or more till what could be the maximum ,since the stm32f4 nucleo board has 128K SRAM. So that the dB calculation can be classified as to normal human ear audible or not?

The audible range for the human ear spans theoretically from 20kHz to 20kHz, but actually the bandwidth is lower, i.e. 50Hz to 15kHz. Consider also that there is an additional filter in the calculation, that simulates the ear frequency response curve, the A-weighted filter, which is centered around 2kHz and start decreasing after 5kHz. My suggestion would be use the 16kHz standard, an acceptable trade off between the available memory on one side, and the fidelity, capability of acquiring human speech frequency (max 8kHz) and audible bandwidth on the other side.

>> How to set the exact baud rate for applications like these in general?

You should set a Baud rate at least equal to the PCM frequency x bit depth of the audio word, but better if it is at least 1.5 times greater.

-Eleon

View solution in original post

6 REPLIES 6
Eleon BORLINI
ST Employee

Hi Shweta,

>> 1) How to calculate the dB SPL for a MEMS mic captured PCM values in a log file?

For a generic rule to convert the PCM wav file into dBSPL, I would suggest you this post on NI community. ST implements this feature in the library of the following point.

>> 2) How do we add the acoustic_dB library to a STM32f4xx ?

I probably already tell it to you, but I suggest to give a look and use the X-CUBE-MEMSMIC1 firmware package, and in particular the Microphones_Streaming project that you can find in the \Projects\STM32F401RE-Nucleo\Demonstration\CCA02M2\Microphones_Streaming folder.

>> My second question continues to be the how can this PCM value be converted to .wav format?

The project enables the streaming of the PCM (converted from the PDM) towards a host PC via a dedicated USB Audio Input driver. You could acquire it for example with Audacity and save as .wav file.

Let me know if these info can be of some help for you.

-Eleon

Hi Eleon,

Hope your doing fine and staying safe.

>> Yes I got the generic conversion point of PCM in dBSPL and ST implementing this feature as you had told earlier

(STM32CubeFunctionPack_SMARTMIC1_V2.2.0\Middlewares\ST\STM32_AcousticDB_Library )and even in my first post older the above mentioned application of microphones streaming.

and the other includes (STSW-BCNKT01_V2.3.0\Projects\BlueCoin\Applications\AudioLoop)

I have downloaded all of them the instant you have shared it , still further deeper study research is required for me.

>> I found (/how-to-calculate-db-from-the-mems-microphone-data) answered by you on the some other post ,I found this after posting the question😋

the explanation there cleared most of my doubts ,thanks for that.

>>I have one last questions for now Can we capture/acquire PCM audio samples upto minimum 5000 or more till what could be the maximum ,since the stm32f4 nucleo board has 128K SRAM..so that the dB calculation can be classified as to normal human ear audible or not. ?

>> How to set the exact baud rate for applications like these in general.?

these generic ones

Many of the questions are mainly repetitive I guess, but your time ,patience and suggestions are highly appreciated .. thanks a lot. 😉

Kind Regards

--

Shweta

Hi Shweta,

hope you are staying safe as well too

>> Can we capture/acquire PCM audio samples upto minimum 5000 or more till what could be the maximum ,since the stm32f4 nucleo board has 128K SRAM. So that the dB calculation can be classified as to normal human ear audible or not?

The audible range for the human ear spans theoretically from 20kHz to 20kHz, but actually the bandwidth is lower, i.e. 50Hz to 15kHz. Consider also that there is an additional filter in the calculation, that simulates the ear frequency response curve, the A-weighted filter, which is centered around 2kHz and start decreasing after 5kHz. My suggestion would be use the 16kHz standard, an acceptable trade off between the available memory on one side, and the fidelity, capability of acquiring human speech frequency (max 8kHz) and audible bandwidth on the other side.

>> How to set the exact baud rate for applications like these in general?

You should set a Baud rate at least equal to the PCM frequency x bit depth of the audio word, but better if it is at least 1.5 times greater.

-Eleon

SG.4
Associate II

Hi Eleon,

Glad to have your response so fast.

>> Can you throw some light on the terminologies like audio frequency, PCM frequency.?

and the audio frequency range that we assign in CubeMX amounts to which frequency.?

when the PCM frequency range is given from 8khz to 192khz ? which bit of PCM is more accurate like 16/ 24 bit or does it depend on the datasheet of the particular MEMS mic used?

>> I had also reads the sampling freq is .. fs= (freq.of PDM clock)/(decimation ratio) .

so what does this sampling freq exactly amounts to? If I am not wrong your 1.5 times usually is based on Nyquist theorem is it?

Thanks once again in advance.

Kind Regards

--

Shweta

Hi Shweta,

the PCM frequency is basically the audio frequency of a .wav file, while the bit depth is the resolution of your acquired signal: the higher the bit number, the more accurate the signal is (so that the decoding is able to sense lower signals). For ST MEMS microphones, the full dynamic range can be covered by 24 bits (not by 16 bit, if you are searching for high-fidelity).

For an idea of these parameters, for example an audio track open with Audacity: you can find them just below the track name:

0693W000008wAD8QAM.png 

From the STM32 configuration settings point of view, you can check this tutorial for a deeper on the various audio parameters used in STM32 family MCUs, as for example used for the afore-mentioned audio libraries.

Last, the choice of the (VCOM-UART?) baud rate should oversized with respect to the pure master clock frequency (PCM freq x bits), in order to have a marginal guard-band in case of issues.

-Eleon

SG.4
Associate II

Hi Eleon,

Thank you for all your valuable suggestions and your patience in explaining the things .

I will definitely work on the materials and concepts you have shared.

and will get back if still any problem persists.

Have a great time and take care.

Thank you

Kind Regards,

--

Shweta