Skip to main content
Visitor II
February 17, 2021
Solved

Hello ST Experts I have a query on mems mic interfacing STM32f466re nucleo board i am getting a PCM data in PCM_buffer .Now How do I acquire this data and convert it to dB and print serially for every 1 second or 5 seconds .

  • February 17, 2021
  • 2 replies
  • 1871 views

the noise intensity level print on serially on monitor . from this the threshold has to be set to detect pleasant noise or harmful noises for further coding and analysis.

I am stuck at a point in PCM audio data out conversion to dB i.e noise level .

Below is a image attached on how I am getting the PCM values in buffer. And I am not sure how to validate whether this is correct or wrong.? and after this if any voice or variations in the mic should be showing alterations in the noise level intensity printing serially.

I am a beginner with audio mems mic and audio processing.

Please help .this project is on urgent requirement.

Thanks in advance.

    This topic has been closed for replies.
    Best answer by Eleon BORLINI

    Hi @Community member​ ,

    I checked by our ST experts, and here you can find their feedback.

    • It is not clear if the data you are showing are correct or not, if limited to a screenshot of the debugger... at first glance, they looks wrong, since they are saturated between +-32768, but if this is the very first frame it could be correct to have such numbers, since you have to wait that the CIC filter is converging. In any case, the suggestion is to try to stream the data in some different ways than the debugger (e.g. USB, UART if you are fast enough), in order to have a more complete picture;
    • For the dBSPL calculation, there are a couple of libraries: one in the source code of the FP-AUD-SMARTMIC1 function pack (C\Middlewares\ST\STM32_AcousticDB_Library) and the other one in binary format in the STM32L4Cube firmware package, that you can use when you are able to extract correct data.

    Please let me know if these suggestions help.

    -Eleon

    2 replies

    ST Employee
    February 18, 2021

    Hi @Community member​ ,

    I checked by our ST experts, and here you can find their feedback.

    • It is not clear if the data you are showing are correct or not, if limited to a screenshot of the debugger... at first glance, they looks wrong, since they are saturated between +-32768, but if this is the very first frame it could be correct to have such numbers, since you have to wait that the CIC filter is converging. In any case, the suggestion is to try to stream the data in some different ways than the debugger (e.g. USB, UART if you are fast enough), in order to have a more complete picture;
    • For the dBSPL calculation, there are a couple of libraries: one in the source code of the FP-AUD-SMARTMIC1 function pack (C\Middlewares\ST\STM32_AcousticDB_Library) and the other one in binary format in the STM32L4Cube firmware package, that you can use when you are able to extract correct data.

    Please let me know if these suggestions help.

    -Eleon

    SG.4Author
    Visitor II
    February 18, 2021

    Hi Eleon,

    1)Well even am not clear of the data shown . may be the inputs and suggestions will be considered further .

    Thanks to the ST experts and you.

    2) Well there are lots of libraries firmware packages your guiding through.

    If any assistance needed further will definitely get back.

    Graduate
    February 18, 2021

    I can only offer a few suggestions based on my experience so far with MEMs microphones. Note, I write directly to registers and don't use any libraries:

    • use 32 bit arrays so you can see what the raw data from the microphone looks like
    • you will need a simple filter to remove the DC offset (search for "DC blocking filter Knowles")
    • capture a 1000 or so samples at full speed and download it to a spreadsheet to see what the waveform looks like
    • a tuning fork is handy for producing a test tone
    • your db calculations will depend on the sensitivity of your microphone, I swapped from a -36dBFS to a -26dBFS to get around three times more resolution at low volumes (note a more sensitive microphone will give you less dynamic range)
    • reading "Understanding Microphone Sensitivity by Jerad Lewis" might help
    • beware... I have had some mems microphones fail slowly (probably because they were improperly loaded/washed when they were made) - I hand solder my prototype mems microphones myself now...
    • if you get to product stage, probably best to put the mems microphone on a daughter board for easy replacement
    SG.4Author
    Visitor II
    February 18, 2021

    Hi @Community member​ ,

    Well thanks a lot for your hands on suggestions based on your experiences.

    To be frank I am a total newbie to these MEMS mic audio processing and STM32s MCUs and IDEs.

    But your suggestions will definitely save the time I guess.

    Thanks once again.