Main Archive Specials Wiki | FAQ Links Submit Forum

Conversion and normalization of 16-bit sample to a floating point number

References : Posted by George Yohng
Code :
float out;
signed short in;

// This code does the same as
// out = ((float)in)*(1.0f/32768.0f);
// Depending on the architecture and conversion settings,
// it might be more optimal, though it is always
// advisable to check its speed against genuine
// algorithms.

((unsigned &)out)=0x43818000^in;


Added on : 15/05/07 by yuri_xl[ AT ]tom[ DOT ]com
Comment :
Hi George Yohng

I tried it... but it's create the heavy noise!!

Added on : 20/09/07 by George Yohng
Comment :
    ((unsigned &)out)=0x43818000^((unsigned short)in);

(needs to have a cast to 'unsigned short')

Add your own comment
Comments are displayed in fixed width, no HTML code allowed!


Are you human?

Site created and maintained by Bram
Graphic design by line.out | Server sponsered by fxpansion