I am experiencing trouble with .wav format writing. The written file can be read back by VLC, but not Audacity (duration is 0, like also when trying to load it from the JUCE app). Can someone tell what is missing in the file creation ? Some appropriate metadataValues ?
The code is the following:
const File dir (File::getSpecialLocation(File::userDocumentsDirectory).getChildFile ("AudioDocs")); dir.createDirectory(); const File file (dir.getNonexistentChildFile("New", ".wav")); DBG("FIle FULLPATHNAME : " << file.getFullPathName()); file.deleteFile(); ScopedPointer<FileOutputStream> fos (file.createOutputStream()); WavAudioFormat wavFormat; AudioFormatWriter* afw = wavFormat.createWriterFor(fos, 44100, buffer.getNumChannels(), 16, StringPairArray(), 0); afw->writeFromAudioSampleBuffer(buffer, 0, buffer.getNumSamples());