I want to create 32bit float WAV files in Python (2.x). While \"standard\" WAV files usually use int, many professional audio applications process (and save) audio data as float
This sounded like fun (see my handle), so I hammered out something. Maybe you can use it. If your Python script generates a monophonic waveform of numerical values that fall between [-1.0 .. 1.0], send that waveform in through sample_array and also specify sample_rate (e.g., 44100 or 48000). This will return to you an array that you can write to disk as a .wav file.
I tested the resulting .wav output in Windows Media Player, Apple QuickTime Player, and VLC (all on Windows 7). They all played it.
def float32_wav_file(sample_array, sample_rate):
byte_count = (len(sample_array)) * 4 # 32-bit floats
wav_file = ""
# write the header
wav_file += struct.pack('