This project has moved. For the latest updates, please go here.

Invalid wave file - No fmt chunk found

Jul 18, 2011 at 11:06 AM

I try to use WaveFileWriter in way that every buffer I got i write to file. like this:

writer.write(buffer.data, 0, buffer.data.length);

I the folder I see file with the correct size.

when I try to open it I got this exception.

What I did wrong?

Editor
Jul 19, 2011 at 12:53 AM

You need to define the format of the file so that it can be written out at the beginning.
Please review this tutorial: http://opensebj.blogspot.com/2009/04/naudio-tutorial-5-recording-audio.html

Regards,
Sebastian

Jul 19, 2011 at 7:57 AM
Edited Jul 19, 2011 at 8:22 AM

Sebastian I know. this what I did:

writer = new WaveFileWriter(fileName, format);

void OnReceiveData()
{
    writer.Write(buffer.data, 0, buffer.data.Length)
    buffer = null;
}
 
Coordinator
Jul 19, 2011 at 8:12 AM

did you dispose the WaveFileWriter? This is very important as it writes some offsets into the WAV file header.

Jul 19, 2011 at 8:20 AM

Thanks Mark!

Its work now.