juce-framework / JUCE

JUCE is an open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, LV2 and AAX audio plug-ins.
https://juce.com
Other
6.49k stars 1.72k forks source link

Feature Request: Enable encoding 32-bit float WAV and AIFF #269

Open jrlanglois opened 6 years ago

jrlanglois commented 6 years ago

Both formats mentioned in the title support writing/reading 32-bit float audio, but AudioFormatWriter does not allow mutating usesFloatingPointData.

Needless to say, this would also require checks to be sure AudioFormatWriter::bitsPerSample is 32.

m-hilgendorf commented 6 years ago

I was just digging into this because I needed it for a project, and it looks like if you set the bitsPerSample argument in WaveAudioFormat::createWriterFor() to 32, then it will set the format code of the fmt chunk to WAVE_FORMAT_IEEE_FLOAT. If the code is assuming you're writing floating point instead of PCM when you set that value to 32, it should probably be mentioned somewhere in the documentation.

That said I think the code is erroneous because it doesn't write 0 to cbSize which must be done for non-PCM formats without a format chunk extension.

I have never really dug into the Wave spec before so I may be totally off base here.