‎2019-12-08 06: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.
‎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.
‎2019-12-09 03: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
‎2019-12-09 04: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 ?
‎2019-12-09 04: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).
‎2019-12-09 04:40 AM
By the way thanks for support :blue_heart:
‎2019-12-09 05: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.
‎2019-12-09 06: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'
‎2019-12-09 07: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.