Type : waveform generation, Taylor approximation of sin()
References : Posted by Phil Burk
Code from JSyn for a sine wave generator based on a Taylor Expansion. It is not as efficient as the filter methods, but it has linear frequency control and is, therefore, suitable for FM or other time varying applications where accurate frequency is needed. The sine generated is accurate to at least 16 bits.
for(i=0; i < nSamples ; i++)
//Generate sawtooth phasor to provide phase for sine generation
//Wrap phase back into region where results are more accurate
if(phase > 0.5)
yp = 1.0 - phase;
if(phase < -0.5)
yp = -1.0 - phase;
yp = phase;
x = yp * PI;
x2 = x*x;
//Taylor expansion out to x**9/9! factored into multiply-adds
fastsin = x*(x2*(x2*(x2*(x2*(1.0/362880.0)
outPtr[i] = fastsin * amplPtr[i];
Added on : 23/01/11 by barbarawright[ AT ]mail15[ DOT ]com
The <a href="http://bestfinance-blog.com">loan</a> are essential for people, which want to organize their career. By the way, this is not very hard to receive a commercial loan.
|Add your own comment|
Comments are displayed in fixed width, no HTML code allowed!