cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to Play large wav file(262KB) continuously using BSP_AUDIO_PLAY in STM32L476VG discovery board.

sdura
Associate

Hi , Guys I have been Trying to Play a wav file of 262kb from Flash using the BSP_AUDIO_PLAY function available in the STM32L476VG demo code. so when the prompt is playing there it is not playing continuously there is split in the sound , how to play the file continuously. Kindly give me answers guys it will be very helpful for me as i am beginner in using STM32 

1 REPLY 1

What do you mean by continuously? You don't want the pop between the end and beginning of the wav when looped, or are there drops inside the wav too?

> Kindly give me answers guys it will be very helpful for me as i am beginner in using STM32

Now I could dig into that code and tell you something like "add *** to line YYY", but how exactly would you learn from that as a beginner?

This is an overtly complex code, involving several layers of code and an operating system (RTOS). If the problem is between the end and beginning of the wav, the reason is, that upon AUDIOPLAYER_EOF, in [STM32Cube_FW_L4_Vx.x.x]\Projects\STM32L476G-Discovery\Demonstrations\Modules\audioplayer\audioplayer.c, the player is stopped by calling BSP_AUDIO_OUT_Stop()(which involves a complete "deinitialization" of all related hardware, including the CODEC) and then the whole bunch is started up again (AudioPlayer_Start()). This is witnessed by the pops and the fact that the beginning of the file is "cut", as the charge pump of the CODEC is starting up while the mcu is already streaming data. You would need to avoid the stop/start, and only rewind the file by simply

if (hAudioPlayer.state == AUDIOPLAYER_EOF) {

hAudioPlayer.read = hAudioPlayer.start;

}

JW