On Fri, 2006-05-12 at 00:11 -0400, John Sauter wrote: > On 11 May 2006 at 20:41, James Richard Tyrer wrote: > > > You need to consider the dynamic range of the output DAC and the > > amplifier that you are feeding. You really aren't going to get more > > than 22 bits of output resolution. You just aren't going to get analog > > amplifiers with much more than 100 dB dynamic range. > > > > So, unless you have a viable way to use the float data to drive two DACs > > and a VCA as the output buffer, you aren't going to gain anything with > > float data. > > I agree that the analog ends of the system cannot handle the dynamic > range of 32-bit floating point. The microphones would provide values > in the range of plus or minus 1, with no more than 22 bits of precision. > The speakers would expect the same range, and would clamp values > outside that range. Where floating point wins is in internal processing. > You can apply filters and special effects without any concern about their > effect on the volume, then scale back to plus or minus 1 at the final > stage. If you try to do that with fixed point you lose all of your precision.
Actually, it's exactly the opposite. Floating point numbers are not magic. For any a priori known dynamic range, floating point is always worse than fixed point for audio use. People seem to think that floating point numbers are real numbers; they are wrong. Let me ask you a simple question: How would you calculate the average of a large number of samples, using floating point samples and operations? (Hint: The obvious answer is wrong.) For extra credit, why is the naive implementation wrong, and exactly what effect would it have? If this was a FIR filter, what effect would it have on the real values of the taps? If you are serious about maintaining precision, then you will do the job right using either floating point or fixed point operations. However, it would take more operations and would have greater complexity to do it right using floating point. In some cases, O(n) operations become O(NlogN) or, even worse, the order becomes data dependent, which means your processing latency becomes data dependent. Any floating point implementation of a FIR filter with a large number of taps will be wrong if the standard algorithm for fixed point arithmetic is used. On average, I do not trust the average computer programmer to be a computer scientist, and the average computer programmer would produce a crummy solution using floating point. Their results would be coloured and they would never know why, assuming they ever noticed. For any non-trivial algorithm, the implementor would probably have to be a pretty good at numerical analysis to figure out the exact effect floating point representation would have on their results. Serious audio DSPs use 24-bit samples with 56-bit accumulators and tightly controlled rounding for a reason: once you have set things up, your algorithms do what you think they should do, with bounded and reliable imprecision. Also, your implementation can naively follow the mathematical description of your filter and still be correct and useful. With fixed point, it's usually obvious when the programmer has something wrong. With floating point, it is usually not obvious until everything explodes at some random moment in the future, or the implementation is simply mostly right for all time, and never gets fixed. Friends don't let friends do audio processing in floating point! Cheers, Ray _______________________________________________ Open-graphics mailing list [email protected] http://lists.duskglow.com/mailman/listinfo/open-graphics List service provided by Duskglow Consulting, LLC (www.duskglow.com)
