[music-dsp] 32 bit floats >>> 24 bit integer

Nigel Redmon earlevel at earlevel.com
Thu Jan 19 18:03:25 EST 2006

Generally speaking, there is no sense in wasting computing power to  
dither a signal to 24 bits. If you're going to play back the 24-bit  
value at some point, good luck getting a D/A and repro system whose  
noise floor wouldn't bury the effects of the dither--short of using  
cryogenics (the LSB is -144 dB full scale). 32-bit floats have  
roughly the same resolution at "full code" as 24-bits (24-bit  
mantissa plus sign bit, compared to 24-bits including sign for 24-bit  
ints); floats have an advantage in dynamic range, but if you do your  
final adjustment for audio level before the conversion, as you  
should, the two come out even. Dither when you need to output to  
shorter word lengths.

There are other issue in the conversion--under windows & intel, it  
can be really slow to do it the obvious way in C (because assignment  
of float to int in C is by truncation, and microsoft libs have  
convergent rounding IIRC as the default--Visual C/++ makes a lib call  
to change the rounding mode, which take an incredible amount of time  
due to emulating ancient math coprocessor hardware...). It's not a  
problem on PowerPC chips and other things, but for wintel you can  
avoid the mode change by using assembly language. You should find  
something on musicdsp.org, or searching the list archives.

On Jan 19, 2006, at 2:16 PM, kernel wrote:
> hello,  what's the best way to convert from 32 bit floating point  
> audio to 24 bit integer whilst retaining the best audio quality.
> are we talking simple truncation and a splash of dither?  these are  
> multichannel files so I guess it would be best to dither the mix  
> bus instead.
> thanks, stephen.

More information about the music-dsp mailing list