This project has moved and is read-only. For the latest updates, please go here.

Decoding IeeeFloat 32 bits per channel

Feb 24, 2012 at 10:58 AM
Edited Feb 24, 2012 at 11:00 AM

I am attempting to decode the data in a class derived from WaveStream via the Read() function. WaveFormat indicates that the data is IeeeFloat, 32 bits per channel. i am having real trouble decoding this into left and right channels in such a way that it  makes any sense (currently what i get via BitConverter.ToInt16 is very noise and not balanced between channels). 

further i don't understand what IeeeFloat means, as presumably there is 16 bits per channel per sample. meaning a float from two bytes. is that a short float? is there even such a thing?

Feb 24, 2012 at 10:59 AM

It is 32 bits per sample - that means four bytes for left, four bytes for right. use BitConverter.ToFloat() to convert bytes into floats.

Feb 24, 2012 at 11:05 AM

ok, thanks. i was assuming a sample contains both left and right channels. this makes much more sense.

Feb 24, 2012 at 11:09 AM
Edited Feb 24, 2012 at 11:11 AM

"use BitConverter.ToFloat() to convert bytes into floats."

just for other peoples benefit. this is actually called BitConverter.ToSingle() for some strange reason

Feb 24, 2012 at 11:38 AM

oh yeah, I forgot they called it ToSingle(),

Feb 28, 2012 at 11:28 PM
drmo wrote:

just for other peoples benefit. this is actually called BitConverter.ToSingle() for some strange reason

The C# float keyword is really just a compiler alias for the BCL type System.Single, so having a BCL class refer to it as ToSingle isn't the strange part. I believe it's called Single because IEEE 754-1985 called it single, although VB programmers probably think it's because VB called it Single all along.