Hello, I am doing audio processing on audio wav files and it works fine. Now I am downloading freesound audio sample with the following command: sound.retrieve_preview()
This works well and downloads the audio with the wav format I specified in the query and plays fine on the IDE. However, when I try to open the file using this:
gSampleBufferLength = getNumFrames(gFilename);
if(gSampleBufferLength <= 0) {
rt_printf("Error loading audio file '%s'\n", gFilename.c_str());
return false;
}
gSampleBuffer = new float[gSampleBufferLength];
if(gSampleBuffer == 0) {
rt_printf("Error allocating memory for the audio buffer.\n");
return false;
}
// Load the sound into the file (note: this example assumes a mono audio file)
getSamples(gFilename, gSampleBuffer, 0, 0, gSampleBufferLength);
rt_printf("Loaded the audio file '%s' with %d frames (%.1f seconds)\n",
gFilename.c_str(), gSampleBufferLength,
gSampleBufferLength / context->audioSampleRate);
I get the following error:
"Couldn't open file audio_sample.wav: File contains data in an unknown format.
Error loading audio file 'audio_sample.wav'"
It also doesn't play on my computer but it still says that the type is wav.
Is there any extra information I should look out for? Does it have to do with compressed/uncompressed?
Thank you in advance!