Re: [linux-audio-dev] Fixed vs. floating point

From: Tim Goetze <tim@email-addr-hidden>
Date: Fri Oct 14 2005 - 13:26:09 EEST

[Hannu Savolainen]

>This is the main reason why many audio applications use floating point
>internally. However many (or most) applications do just simple
>computations which are easy to do in fixed point too.
>
>Hint: Scale the input samples to the -1.0..1.0 range regardless of the
>input precision (8/16/24). Scale samples to the desired output format just
>before writing them to the device or to a file. This
>will make your life much easier.

i'd like to add that due to quantization, signal quality can quickly
suffer in fixed-point if you do a lot of consecutive calculations on
it (not even considering you have to be darn careful not to clip the
signal at overflow). a quiet signal, or any signal around
zero-crossings, is represented in fixed-point by only a very small
number of bits -- two simple multiplications can lead to end results
varying greatly from the ideal (infinite precision) result. if the
signal level is low and the end user raises the final gain to
compensate, the results can be quite disastrous.

for example, implementing an iir filter of only medium complexity (in
fact, anything more complex than a biquad) in fixed-point requires
jumping through a lot of hoops (decomposition into a chain of biquads,
usually). in floating-point, simply implement the filter loop and
history in doubles if the filter gets complex, and you're done --
without slowing down execution substantially (on x86 at least).

as long as your target platforms support it with reasonable processing
speed, choose floating point.

cheers, tim
Received on Fri Oct 14 16:15:05 2005

This archive was generated by hypermail 2.1.8 : Fri Oct 14 2005 - 16:15:05 EEST