STM32F4 Read wav from USB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-08 6:16 AM
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;
And my own project inside audio buffer data;
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.
- Labels:
-
Audio
-
STM32F4 Series
-
USB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-08 10:44 PM
> 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-09 3:40 AM
I mean, i can get waveformat data from file(FileSize, Byterate, Samplerate.. etc) but when i want read audio data i getting just zeros
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-09 4:31 AM
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-09 4:40 AM
There is a wav file in my usb stick. I'm working for interperting on Play() function in main.c file(with f_read, f_open).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-09 4:40 AM
By the way thanks for support :blue_heart:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-09 5:29 AM
Ah, I see.
However, the code is a bit brave, I think.
You read the WAV header first without checking the content and size.
And why do your rewind to read the audio data ? The data usually start after the header.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-09 6:01 AM
I can read header and i've tried read data after header, that doesn't work. The point is i get receive the same data continuously as '/0'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-09 7:17 AM
> I can read header and i've tried read data after header, that doesn't work. The point is i get receive the same data continuously as '/0'
I assume you compared with the actual file contents.
Have you checked the return value of f_read(), and the "bytesread" variable ? Your posted code does not.
I would check, perhaps in a debugger.
I had worked with older version of fatfs a while ago.
