How to write wav file with 32-bit float data?

Judah Menter picture Judah Menter · Jan 14, 2010 · Viewed 19.5k times · Source

I would like to be able to write PCM wav files with 32-bit floating point samples. This seems to be a valid format since libsndfile claims to support it.

However, if I specify in my header a sample size of 32-bits, any program I open it in assumes that it's 32-bit integer data. What flags, etc need to be set in the wav file header to specify floating point data?

Can anyone point me to some documentation that explains how to do this?

Answer

Han picture Han · Jan 15, 2010

You need to set the wFormat tag in the 'fmt' chunk to WAVE_FORMAT_IEEE_FLOAT (3).

A good source for the WAVE format specification is this page.