How to convert a wav file into a data array and upload it to intel quartus?

36 Views Asked by At

I'm currently facing a fascinating challenge in my Quartus project: I need to transform a WAV file into a data array. It's a bit of a puzzle, and I'm looking for the expertise and insights of fellow enthusiasts and experts in FPGA and digital signal processing. If you've got experience or ideas to share, I'd greatly appreciate your help and guidance.

I did not try anything yes due to the fact of my limited experience on it

1

There are 1 best solutions below

0
George On

Use a WAV File Management library, like C89 WAV, and read all of the samples into a vector - like in the following example.

vector<WAV_PCM16> data;

///////////////////

WAV_FILE  file = wav_open("/path/to/file.wav", WAV_READ);
WAV_PCM16 sample;

if (wav_is_open(&file)) {
    
    while (wav_has_next(&file)) {
        wav_next_sample(&file, &sample, NULL);
        data.push_back(sample);
    }
    
    wav_close(&file);
}