> >Are you sure this is not the Goertzel algorithm? > Scott > >has a page that discusses this algorithm. > > > Sure it is not. The Goertzel algorithm calculates > sine value by a recursive Yeah, I misunderstood what you were describing. Sorry > > > >Also, here's a dtmf generator that uses Goertzel > >http://www.ti.com/sc/docs/psheets/abstract/apps/spra066.htm > > > > > Are you kidding? This is a decoder algorithm. No, I'm not kidding, just wrong. > >http://www.g4dvj.demon.co.uk/dds.htm > > > > > Thanks for the link. Explanation is perfect. 1 out of 3 pieces of information distributed on the pic list is decent. :) > I think that my method resembles phase accumulator > and table method except > there is no table. The table is generated on the run > and this is triangle. > In my case error of triangle generation is lower, > because there is no > restriction to use only table values. Finally, this > reduced error makes the > sine wave frequency more stable. Certainly, the > phase accumulator method is > more straight-forward and simple, at the cost of > frequency jitter. In case > of DTMF this is mainly the frequency what matters, > because DTMF frequencies > are very close. True, butt, if you incorporate the proper interpolation along with your look up table, then the jitter effects are mitigated. Without any interpolation, the sinewave output from the look-up table is a stair-stepped waveform. The higher the update frequency, the smaller the steps and the closer to a sine wave approximation. This 'stair-stepped' wave form however is a form of interpolation; specifically zero-order interpolation. You may have heard of a "zero-order hold" in your studies on signals and systems (and perhaps z-transforms). According to the 'theory', as long as you satisfy the Nyquist sampling criterion, you can exactly reproduce the synthesized wave form. But I couldn't look at you with a straight face and say it's possible. The caveat is that a perfect low-pass filter must be constructed. DTMF competition is much too cheap for us to insist on perfect analog filters. So the next step is first order interpolation. For our application, this is linear interpolation between consecutive samples in the table. (For sampling theory, there are some subtle but important differences on the interpretation of a first-order hold.) Which is to say, if you need a sample that is not (exactly) at one of the sample points in your table, then you approximate it by using linear interpolation. For example, suppose you had a table with 10 samples: f(i) is the function defined for i =0..9 . Now suppose you need f(2.25)? Well, using linear interpolation you'd approximate this: f(2.25) - f(2) f(3) - f(2) -------------- = ------------- 2.25 - 2 3 - 2 f(2.25) ~= f(2) + 0.25*(f(3) -f(2)) >From a frequency or spectral point of view, linear interpolation's effect on higher harmonics are approximately the square of the harmonics introduced by zero-order interpolation (sinc vs. sinc^2). And since the magnitude of the higher harmonics is less than one, this is a good thing (e.g. 1/9 is much smaller than 1/3). The direct implication is that the stringent low-pass filter constraints associated with the stair stepped waveform can be relaxed. >From an intuitive view, you can see how first-order interpolation improves the table values. For example, if you had 64 samples of sine wave over one cycle, then the deviation between linear interpolation and the 'true value' of the sine wave is quite small. In fact, an error bound may be placed on it. Specifically, as I alluded to in another thread, you can use the Cauchy Remainder Theorem for interpolation. In essence, this theorem states that the error is bounded by the n'th derivative of the function your approximating, where n is the order of the interpolation (1 for linear). So in the above example, The error in approximating: f(2.25) ~= f(2) + 0.25*(f(3) -f(2)) error <= abs(f'(3) - f'(2)) Now there are additional caveats, like you still have to satisfy Nyquist. .lo ps. Please forgive any mistakes, this is all from memory... ===== __________________________________________________ Do You Yahoo!? Bid and sell for free at http://auctions.yahoo.com