WAVE 32bit floats is easy ; the wFormatTag field is 3 instead of 1, and the various bitspersample and blockAlign fields have to reflect the 32bit wordsize, as you woudl expect. You should use the WAVEFORMATEX form of the header, 18bytes long (the added 16bit word is zero; it gives the count of any extra bytes in the header, which would indicate a compressed format). 0dBFS value is 1.0; "over-range samples are allowed, and should be clipped by the rendering device".
Note that 32bit integer WAVE files are also possible (wFormatTag = 1 in the usual way).
AIFF-C floats is more complicated, but is also being supported more widely, so would be worth adding to PD some time. There is code in Csound now for both WAVE and AIFF-C floatsam files. Apple, bless them, don't specify 0dBFS, but it can be reliably understood to be 1.0 as well.
A while ago Tom Erbe and I (with encouragement from an audio person at Microsoft) defined a PEAK chunk specifially to go into floatsam files, (for WAVE, WAVE_EX, and AIFF-C), though it has convenience even with the integer formats; this has also recently been added to Csound. The PEAK chunk (together with the AIFF-C floats spec) is available from Tom's website:
http://shoko.calarts.edu/~tre/
If you want to get PD ~really~ up to date, you might consider adding some support for the new WAVE-FORMAT-EXTENSIBLE (WAVE-EX) format, which should really be used instead of WAVE for all high-resolution audio, and certainly for any low-level rendering code, for Windows systems with WDM drivers. It's other claim to fame is support for defined speaker feeds for surround sound. I have a fairly comprehensive web page for it at:
http://www.bath.ac.uk/~masjpf/NCD/researchdev/wave-ex/wave_ex.html
and will be publishing WAVE-EX handling code ere long, quite possibly for Csound. I would normally offer to do it myself for PD, but I am really swamped with projects at the moment, and just can't take on another one!
Richard Dobson
Miller Puckette wrote:
Hi Tom,
soundfiler only knows about "nextstep" floating-point soundfiles, but can read Wav and Aiff 24-bit fixed files too. I think there's a 23-bit floating point type defined fo Wav files, but I don't know what the header looks like; someday I hope to find this out and support it.
cheers Miller