🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.dsp
Article #1774

Re: Sine-wave generator algorithms

#1774
From: Al Kovalick
Date: Fri, 03 May 1991 22:16
28 lines
1905 bytes
 Several responded with the sine recursion formula method of generating
a sine wave. IMHO this is the FASTEST method for generating a sine wave
short of the table look up method.  Actually, for say 12 bit precision,
a chordal fit to a sine wave will yield a faster algorithm at the expense
of amplitude resolution and quantization error.  In fact with only 2
straight lines fitting from 0 to 90 degrees the max departure error is
only about 2.7%.  The straight line fit method still needs a look up
table but with only 32 or 64 entries for the first quadrant. The other
quadrants may be derived thru quadrant logic based on the first.  

I've always been interested in the tradeoffs made when deriving sine
compute algorithms.  The speed VS accuracy tradeoff is the most
interesting.   BTW, the previously mentioned recursion method is used in
almost all FFT/IFFT transforms that are worth their salt. Using C and
all variables in DOUBLE, I have generated 1 million points with the
limit cycle noise less than -100 dB ref 1.0.  Also the recursion method
is only practical when you need to compute a succession of sine points
with equally spaced time increments.  For random look up, the chordal
fit with small table is best, albeit the amplitude noise may be high.  

Finally, the recursion method is based on the trig identity

 SIN(N*a) = 2*SIN((N-1)a)COS(a) - SIN((N-2)a)    ! simple, beautiful.

Happy generating !!

Al Kovalick  Hewlett-Packard Stanford Park Division, Palo Alto, Ca.
Technical Details
Message-ID: <17540003@hpspdra.spd.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!sdd.hp.com!hplabs!hpl-opus!hpspdra!alk
References: <1991Apr24.050126.8668@cs.cmu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!sdd.hp.com!hplabs!hpl-opus!hpspdra!alk
From: alk@hpspdra.spd.HP.COM (Al Kovalick)
Newsgroups: comp.dsp
Subject: Re: Sine-wave generator algorithms
Message-ID: <17540003@hpspdra.spd.HP.COM>
Date: 3 May 91 22:16:49 GMT
References: <1991Apr24.050126.8668@cs.cmu.edu>
Organization: HP Stanford Park - Palo Alto, CA
Lines: 28