cancel
Showing results for 
Search instead for 
Did you mean: 

Sample rate on BSP Audio Capture (b-u585i-iot02a)

lucadelf
Associate

Hello everyone,

I’m programming a B-U585I-IOT02A board. My goal is to capture audio through the integrated microphone at a sampling rate of 44 kHz and then analyze it using callbacks.

I’m using the example provided by ST Electronics, the BSP, from which I use the audio functions, specifically:
BSP_AUDIO_IN_Record(0, (uint8_t*) RecBuff, RECBUFF_SIZE*2);

First, I initialize the structure like this:

 


BSP_AUDIO_Init_t AudioInit;
/* Select device depending on the Instance */
AudioInit.Device = AUDIO_IN_DEVICE_DIGITAL_MIC1;
AudioInit.SampleRate = AUDIO_FREQUENCY_44K;
AudioInit.BitsPerSample = AUDIO_RESOLUTION_16B;
AudioInit.ChannelsNbr = 1; AudioInit.Volume = 50; /* Not used */
if (BSP_AUDIO_IN_Init(0, &AudioInit) != BSP_ERROR_NONE) {
   Error_Handler();
}


The issue I’m facing is: when I use a RecBuff (of type uint16_t) with a length of 44100, I get a callback every 250 milliseconds instead of every second.
However, with a sampling rate of 11 kHz and a RecBuff length of 11000, I get exactly one callback per second, which is expected.

Why is this happening?

I absolutely need the 44 kHz sampling to work.
Please, I hope someone familiar with this ST Electronics example can help me understand this behavior. Thank you very much!

0 REPLIES 0