|
|
| JSyn | |
| Tutorial | |
Remember, you won't have to use these techniques in your programs. You just create a SquareOscillator, or some other oscillator, and use it. But this page will give you a better understanding of what you are getting.
Here we can see
a square wave in red superimposed over a sawtooth wave. Notice that when
the sawtooth wave is above zero that the square is high, and vice versa.
So to make a square wave, JSyn first generates a sawtooth then does this:
if( saw > 0.0 ) square = 1.0; else square = -1.0;
if( saw >= 0.0 ) triangle = 1.0 - ( 2.0 * saw ); else triangle = 1.0 + ( 2.0 * saw );
sineWave = sin( PI * saw );[TOP] [PREVIOUS] [NEXT]
© 1997-2009 Mobileer Inc All Rights Reserved