cancel
Showing results for 
Search instead for 
Did you mean: 

How to add FFT algorithms in the AMICAM1\Microphones_Streaming based on NUCLEO-STM32L476RG ?

shenghua yang
Associate III
 
4 REPLIES 4
shenghua yang
Associate III

Dear All:

I would like to add FFT algorithms in the "AMICAM1\Microphones_Streaming" based on NUCLEO-STM32L476RG ?

From the document of UM1901, we can get audio data in the callback function(AMICAM1_AUDIO_IN_TransferComplete_CallBack) per 1 msec with 192KHz of samping rate as below.

0693W00000aHvU1QAK.pngWe hope to save 6 msec of audio data in the PCM_Buffer(192*6=1152, 24 bits of data) from AD1974 for FFT analysis.

When finishing the 1152 bytes of audio data collection, we normalize transfer 24 bits audio data into the range of +/- 1 audio signal for implementing FFT analysis.

We also can find the fft.c in the library of middle ware as below.

0693W00000aHvfYQAS.png

There are some FFT API in a compiled HTML file located in the Documentation folder.

0693W00000aHvjQQAS.png

How to implement the 1024 point of FFT algorithms step by step?

Best Regards,

Sheng-Hua

SPRAD.1
ST Employee

Hello @shenghua yang​ 

X-CUBE-MEMSMIC1 already provides an example using FFT.

Is it called UltrasoundFFT and it is placed here: Projects\STM32L476RG-Nucleo\Demonstration\AMICAM1\UltrasoundFFT\.

Start looking at this code example, that is fully working and already provides what you need.

Best regards

Simone

shenghua yang
Associate III

Dear Simone:

Thanks your help.

We have found the ​UltrasoundFFT and successfully compiles the project.​

It runs a 512 points of FFT algorithm with 50% of overlapping.

 FFT_Lib_Init(512, 0.5f);

Which microphone(M1,M2,M3,M4) elements are used to do FFT in this project?

void AMICAM1_Data_Ready(uint8_t *buf, uint16_t size, double timeStamp)

{

 FFT_Lib_Data_Input((int16_t *)buf, size / 2);

}

Best Regards,

Sheng-Hua

SPRAD.1
ST Employee

Hi @shenghua yang​ 

The demo uses M1.

Best regards

Simone