On Wed, 4 Nov 1998, Peter L. Peres wrote: > Hello, > > a reasonably bright idea has just struck me. I have been following this > thread for some time and I am familiar with the table method of generating > a sine (quarter wave stored). > > My idea is, that since the Bresenham circle algorythm exists, it is > possible to compute the 'next' value for a phase continuous sine wave > without storing any table and by obtaining results directly in integers > (no floats no lookups no nothing). Enlighten my ignorance, what the hell is the 'Brensenham circle algorithm'? From context, I presume it's a recursive algorithm useful for computing the x & y coordinates of a circle as you equidistant (i.e. equiangular) steps. If that's the case, then it's not too unsimilar to the goertzel algorithm. The problem I've found with the goertzel algorithm is that round off errors gradually increase to the point where sines and cosines are no longer produced. If you're computing a few cycles of sines and cosines, then the goertzel algorithm is great: it's fast and efficient. > > Any single DTMF tone starts at phase 0. So, one can use the Bresenham > circle algorythm to approximate the 1st quarter wave of a sine. This > should replace the quarter sine table. And I suspect because of round off errors you'd have to repeat this quarter circle calculation every quarter of a circle - unless of course you store the results in an array. But if you do that, you might as well implement the array... It's possible to combine algorithms. For example, if you needed higher resolution you could store the same number of samples in the table for just 1/8 of the circle. (Beyond 1/8, you'll have to start using trig identities that involve irrational numbers.) Then instead of linear interpolation you may use cubic splines or goertzel steps. But in the few applications I needed sinewaves, lookup tables and linear interpolation proved to be fast and accurate enough. Scott