Skip to main content
Visitor II
December 8, 2019
Question

STM32F4 Read wav from USB

  • December 8, 2019
  • 1 reply
  • 2650 views

Hello everyone! I'm working on a project like Audio Playback. I have tried compile and run Audio_playback_and_record from ST's Firmware pack its working good.

I'm trying create my own project file, i'm stuck in read wave data from usb. I can get waveformat data but i cant get audio data.

I have tried debug results are bellow;

Audio_playback_and_record inside audio buffer data;

0690X00000AtQ57QAF.jpg

And my own project inside audio buffer data;

0690X00000AtQ5CQAV.jpg

As you can see there is always '/0' except 0-99 indexes(that's include audio format data like wave, riff.)

I attachted my project file. Please help me.

Best Regards.

    This topic has been closed for replies.

    1 reply

    Explorer
    December 9, 2019

    > I'm trying create my own project file, i'm stuck in read wave data from usb. I can get waveformat data but i cant get audio data.

    > I have tried debug results are bellow;

    Not sure what you mean.

    Opening a WAV file itself is the easier part. The file format is a bit more complex, originally copied from Amiga's AIFF.

    It is a container format, consisting of declarative "chunks", and the actual data chunk(s).

    In total, WAV supports about two dozen encoding formats, 16 bit PCM being the most widespread.

    To get the audio data, you need to properly read and interpret the "WAVE" chunk, and read the actual data according to the encoding method.

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

    emetiansAuthor
    Visitor II
    December 9, 2019

    I mean, i can get waveformat data from file(FileSize, Byterate, Samplerate.. etc) but when i want read audio data i getting just zeros

    Explorer
    December 9, 2019

    Have you checked the WAV file on the host platform ?

    On quick glance, I couldn't detect any WAV interpreting code in your zip.

    Can you read the file as plain binary in your application, especially the PCM data ?