I just recently started using JUCE and have found it very useful so far but I'm having a problem saving a .wav file to disk. The code giving me trouble is is:
//save the filtered output ScopedPointer<WavAudioFormat> wavFormat = new WavAudioFormat(); File output("C:\\DEV\\FFT2\\filtered_output.wav"); FileOutputStream *fost = output.createOutputStream(); AudioSampleBuffer write_to_disk(&float_output, 1, M + P - 1); ScopedPointer<AudioFormatWriter> writer = wavFormat->createWriterFor(fost, 44100, 1, 16, StringPairArray(), 0); writer->writeFromAudioSampleBuffer(write_to_disk, 0, M + P - 1);
I know the data in float_output is good because I wrote it to a .txt file and imported it in Matlab to verify. I'm not sure if I'm opening the file/creating the streams/or calling write correctly.
Matlab gives the following output.
>> output = wavread('filtered_output.wav'); ??? Error using ==> wavread at 166 Incorrect chunk size information in WAV file.
Any help would be greatly appreciated.