Re: [music-dsp] Precision issues when mixing a large number of signals

2012-12-09 Thread Bjorn Roche
On Dec 9, 2012, at 2:33 PM, Alessandro Saccoia wrote: Hi list, given a large number of signals (N 1000), I wonder what happens when adding them with a running sum Y. 1N - 1 Y = - * X + ( ---) * Y N N Yes, your intuition is

Re: [music-dsp] Precision issues when mixing a large number of signals

2012-12-09 Thread Alessandro Saccoia
Thanks Bjorn, On Dec 9, 2012, at 2:33 PM, Alessandro Saccoia wrote: Hi list, given a large number of signals (N 1000), I wonder what happens when adding them with a running sum Y. 1N - 1 Y = - * X + ( ---) * Y N N Yes,

Re: [music-dsp] Precision issues when mixing a large number of signals

2012-12-09 Thread Brad Smith
I would consider storing N and your sum separately, doing the division only to read the output (don't destroy your original sum in the process). I guess this is the first thing that Bjorn suggested, but maybe stated a little differently. There's a technique called Kahan's Algorithm that tries to

Re: [music-dsp] Precision issues when mixing a large number of signals

2012-12-09 Thread Alessandro Saccoia
That is really interesting, but I can't see how to apply the Kahan's algorithm to a set of signals. In my original question, I was thinkin of mixing signals of arbitrary sizes. I could relax this requirement, and forcing all the signals to be of a given size, but I can't see how a sample by

Re: [music-dsp] Precision issues when mixing a large number of signals

2012-12-09 Thread robert bristow-johnson
um, a sorta dumb question is, if you know that all signals are mixed with equal weight, then why not just sum the fixed-point values into a big long word? if you're doing this in C or C++, the type long long is, i believe, 64 bits. i cannot believe that your sum needs any more than that.

Re: [music-dsp] Precision issues when mixing a large number of signals

2012-12-09 Thread Ross Bencina
Hi Alessandro, A lot has been written about this. Google precision of summing floating point values and read the .pdfs on the first page for some analysis. Follow the citations for more. Somewhere there is a paper that analyses the performance of different methods and suggests the optimal

Re: [music-dsp] Precision issues when mixing a large number of signals

2012-12-09 Thread Bjorn Roche
On Dec 9, 2012, at 8:18 PM, Alessandro Saccoia wrote: That is really interesting, but I can't see how to apply the Kahan's algorithm to a set of signals. In my original question, I was thinkin of mixing signals of arbitrary sizes. I could relax this requirement, and forcing all the signals

Re: [music-dsp] Precision issues when mixing a large number of signals

2012-12-09 Thread Ross Bencina
On 10/12/2012 1:47 PM, Bjorn Roche wrote: There is something called double double which is a software 128 bit floating point type that maybe isn't too expensive. long double, I believe No. long double afaik usually means extended precision, as supported in hardware by the x86 FPU, and is 80