AudioFormatReader and WAV files question

Yo. Thicko here again.

I need to get a WAV off disk and into a float array. AudioFormatReader gives me int arrays (int**) but I need floats.

I’m mighty confused. If the WAVs fixed point (32 bit signed ints) how do I convert the samples to floats (in -1 to 1 range)

And whats the story with WAVs anyway? I didn’t realise they came in both fixed or floating format. Anyone know a link that’ll explain all this wav crap?

And the “zero-terminated” thing for the arrays? I take it I just make them 1 bigger than the number of channels I need and plonck a 0 in the last element?

Any help appreciated.


there is some good data on wav here:

he doesn’t deal with floating point wavs though.

to convert int data to float data can’t you just divide the int value by the maximum int for the bit depth? IE a 16bit wav in signed form would have positive numbers divided by 32767 and negative divided by 32768