On Fri, 14 Oct 2005 [EMAIL PROTECTED] wrote: > I am in the early planning stage of an audio processing application and I > have come to the point of making the choice between floating point or fixed > point (signed 2's complement) processing. > What do you think is better, and why? Why does jack use floating point? Why > does AES use fixed point in most of their standards?
Fixed point is ideal format for transferring audio data between devices/systems/applications (for many reasons). However there are some serious problems when using fixed point as the internal format inside the applications. For example if you divide a sample by a large enough value the result will be zero (total loss of precision). Equally well if you multiply it by a large number there will be an overflow. This means that a programmer using fixed point needs to keep thinking about precision and overflows all the time. This may require much more hacking energy than developing the algorithms. In particular debugging will be pain. Floating point in turn has 24 bits of precision which is enough for audio. The exponent part takes care of scaling while the mantissa stays always normalized to the full 24 bit precision. In fact 64 bit precision is used for computations and intermediate results inside the FPU (x86 at least). In this way the programmer doesn't need to think about the precision (in most cases). 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. Best regards, Hannu ----- Hannu Savolainen ([EMAIL PROTECTED]) http://www.opensound.com (Open Sound System (OSS)) http://www.compusonic.fi (Finnish OSS pages) OH2GLH QTH: Karkkila, Finland LOC: KP20CM