Showing results for 
Search instead for 
Did you mean: 

Soundmeter Pre Filter

Associate III


I am testing the Soundmeter Example provided in STM32CubeMX for the NUCLEO-F401RE board in conjunction with the expansion board NUCLEO-IKS02A1.

The example works, but the results I get in the Unicleo GUI are not the expected ones.

I am testing the board in the office of my company with a class 2 sound level meter at the side.

The noise in dBSPL  that tipically is present is around 50-60 dBSPL.

I am running the Example Project as it is and I only have modified one line of code to select the Prefilter Type for the Sound Meter Library in file audio_application.c line 172:

/* SMR dynamic parameters that can be updated here every frame if required */

smr_dynamic_param.enable = 0; /* SMR module enabler */

smr_dynamic_param.averaging_time = AUDIO_CFG_SMR_AVGTIME_DEFAULT;

smr_dynamic_param.filter_type = SMR_PREFILTER_AWEIGHTING;/*SMR_PREFILTER_NONE;*/

smr_dynamic_param.mean_level_left = -45;

smr_dynamic_param.mean_level_right = -45;


If I select SMR_PREFILTER_NONE, as default, the noise values I get in the Unicleo GUI

make sense and are around 50 to 60 dBSPL as you can see from the capture below.


If I select SMR_PREFILTER_AWEIGHTING, the noise values I get in the Unicleo GUI

go around 115-120 dBSPL as you can see from the capture below.

These values are wrong and shold be still around the 50 to 60 dB range, as my class two sound meter

with A weighting is measuring as well.



What may be happening when the A_WEIGHTING is configured? Does the sound meter library

work properly in any configuration or just when SMR_PREFILTER_NONE is selected ?


Thanks for your help.




Federica Bossi
ST Employee

Hi @jacopokunak ,

Sorry for the late reply.

Please, try to modify your code in this way:

smr_dynamic_param.enable = 1;                        /* SMR module enabler */
  smr_dynamic_param.averaging_time = AUDIO_CFG_SMR_AVGTIME_DEFAULT;
  smr_dynamic_param.filter_type = SMR_PREFILTER_AWEIGHTING;
  /* smr_dynamic_param.mean_level_left = -45; */
  /* smr_dynamic_param.mean_level_right = -45; */

So basically putting "enable" field to 1 instead of 0, putting "filter_type" field to SMR_PREFILTER_AWEIGHTING instead of SMR_PREFILTER_NONE and commenting lines 176 and 177: the smr_dynamic_param.mean_level_left and smr_dynamic_param.mean_level_left are not necessary.

Let me know if this solves your issue.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Associate III

Hi Federica,

thanks for your help.

I did what you suggested but I still get the same results, the example works with SMR_PREFILTER_NONE but if I use any of the other filtering types ( SMR_PREFILTER_AWEIGHTING or  SMR_PREFILTER_CWEIGHTING ) the sound pressure level values still make no sense and are very high, around 115/120 dBSPL.

The Issue must be related to the smr_library when some filtering is requested I suppose.

Could you try tu run the example with the configuration you sent me to see if it works for you?

My averaging time is AUDIO_CFG_SMR_AVGTIME_DEFAULT 100.


Anyway, the "enable" field was already set to 1 by the example itself just a few code lines after in line 193/194

/* SMR module enabler */

smr_dynamic_param.enable = 1;

error = smr_setConfig(&smr_dynamic_param, pSmrPersistentMem);