Skip to main content
DYann.1
Senior II
March 28, 2025
Solved

Understand a code provided in the example STM32L552E-EV

  • March 28, 2025
  • 6 replies
  • 777 views

Hello,

I would like some advice on understanding a code with an example provided with the STM32L5xx evaluation board. I have this code below :

 /* Initialize the data buffer */
 for(int i=0; i < PLAY_BUFF_SIZE; i+=2)
 {
 PlayBuff[i]=*((__IO uint16_t *)(AUDIO_FILE_ADDRESS + PLAY_HEADER + i));
 }
PLAY_BUFF_SIZE = 4096
uint16_t PlayBuff [PLAY_BUFF_SIZE];

#define AUDIO_FILE_ADDRESS 0x08040000
#define PLAY_HEADER 0x2C

I understand a little bit but where does the value 0x2C come from, what does it come from ? What does PLAY_HEADER mean ?

Thank you for your helps.

This topic has been closed for replies.
Best answer by TDK

The WAV file has a 44-byte header. This skips past the header and reads the data.

6 replies

TDK
TDKBest answer
March 28, 2025

The WAV file has a 44-byte header. This skips past the header and reads the data.

"If you feel a post has answered your question, please click ""Accept as Solution""."
DYann.1
DYann.1Author
Senior II
March 28, 2025

@TDK wrote:

The WAV file has a 44-byte header. This skips past the header and reads the data.


 Where did you find this information ? Indeed, at the beginning it says that you have to load the music into a memory area.

DYann1_0-1743172500335.png

Andrew Neil
Super User
March 28, 2025

WAV is a well-known, standard file format - it is well documented; eg,

https://en.wikipedia.org/wiki/WAV#WAV_file_header

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.