Showing results for 
Search instead for 
Did you mean: 

STM32WBA55G-DK1 audio channel digital processing

Associate II


I want to implement some filters on the two audio channels in the BLE_Audio_PBP_Sink example project.
Where in the code would you recommend that i implement these filters. Where can i without problems alter the audio streams.
Are there any documentation that explains the audio paths through out the system, with references to the code?

Kind regards Malte F. Developer

ST Employee

Hello @flamefire 

What are the filters that you are looking to implement. The filters should be implemented on the process of audio filtration and inside the example.

Best Regards.


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 II

Ideally any filter. The main reason is to implement a cross over filter, and some high and low pass filters.
Could you please reference a method or place in the example project, where i can access the audio/data buffer and apply filters?

Kind Regards Malte F.

Associate II

After further study of the code in the BLE_Audio_PBP_Sink project, i can see that the DMA is used on four channels in main.c. I suspect that maybe two of these channels are used for audio left and right?

DMA_HandleTypeDef handle_GPDMA1_Channel2;
DMA_HandleTypeDef handle_GPDMA1_Channel1;
DMA_HandleTypeDef handle_GPDMA1_Channel7;
DMA_HandleTypeDef handle_GPDMA1_Channel0;

 And these are used externally in many other files.

I then think that i can insert filter processing in the stm32wbaxx_it.c

like this:

  * @brief This function handles GPDMA1 Channel 2 global interrupt.
void GPDMA1_Channel2_IRQHandler(void)
  /* USER CODE BEGIN GPDMA1_Channel2_IRQn 0 */


  //filter processing 

  /* USER CODE END GPDMA1_Channel2_IRQn 0 */
  /* USER CODE BEGIN GPDMA1_Channel2_IRQn 1 */

  /* USER CODE END GPDMA1_Channel2_IRQn 1 */

But its hard to know what channel is left and right audio.
I can also see that there is a SAI driver in the STM32WBA_HAL_Driver directory. The SAI driver is not currently used in the project to my knowledge, but maybe this is a better way to handle the audio data?

Could you share some thoughts on this?

Kind regards Malte F.



here are some clarifications that can help.


-PBP Sink project is using SAI peripheral for I²S generation through the BSP,  (see stm32wba55g_discovery_audio.c)

In the header you can see that several DMA channels are reserved by this BSP : 

-GPDMA1_Channel1 for audio IN : not used at sink

-GPDMA1_Channel2 for audio OUT : used 

-GPDMA1_Channel3 for audio IN (PDM) ; not used 


Note that GPDMA channel 0 and 7 are for the ST Link UART (logs, etc..)


Keep in mind that I²S is done for stereo, then both left and right channels are link to the same DMA handler. Additionally audio buffers are in stereo with channel Left and Right interleaved 


You can add some processing, if CPU is not overloading, by two ways:

-Directly in CODEC_NotifyDataReady() that must be redefined (weak) and that is called after the LC3 processing

-Aligned on a DMA interrupt, when CODEC_ReceiveData() is called, but you may have to delay the signal to ensure that SAI, LC3, and application are still working on separated buffer 


You can find some information related to audio data path here:


Best regards,