Skip to main content
Explorer
March 28, 2025
Solved

Understand a code provided in the example STM32L552E-EV

  • March 28, 2025
  • 1 reply
  • 743 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.

    1 reply

    TDKAnswer
    Super User
    March 28, 2025

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

    DYann.1Author
    Explorer
    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

    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