Main Site Documentation

Wav playback issue


Hello, I am working on my first application for the panda II and I’ve run into a program issue that I need some help working out. My program is modified from the fez audio out example project ( ). The original program worked on my board, and my new .cs seems to work, but when I debug with the new .wav files it returns the error message : "unexpected data subchunk."
Specifically, the problem is in the wave.cs:

//// data sub-chunk ///////////////////////////////////////
if (wav[index + 0] != ‘d’ || wav[index + 1] != ‘a’ || wav[index + 2] != ‘t’ ||
wav[index + 3] != ‘a’)
throw new Exception(“Unexpected data subchunk!”);
index += 4;
uint Subchunk2Size = (ushort)Utility.ExtractValueFromArray(wav, index, 4);
index += 4;
dataSize = (int)Subchunk2Size;

From what I can tell there must be something wrong with my sound files but I don’t understand c# well enough to see what it is.

Thank you, any help is much appreciated,


Welcome to the forum!

It is your wav file. I suggest to read about the wav file format if you want to handle it properly. Another way would be to re save it using an audio software - something like Audacity.


Thanks, I’ll try resaving in another program. I used windows sound recorder, does that have any known issues?