Gamma  0.9.5
Generic Synthesis Library
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
CSine< Tv, Ts > Class Template Reference

Complex sinusoid oscillator. More...

#include <Oscillator.h>

Inherits Ts.

List of all members.

Public Member Functions

 CSine (Tv frq=440, Tv amp=1, Tv dcy=-1, Tv phs=0)
void amp (Tv val)
 Set amplitude.
void decay (Tv val)
 Set number of units to decay -60 dB. Negative = no decay.
void freq (Tv val)
 Set frequency.
void phase (Tv radians)
 Set phase.
void reset ()
 Resets amplitude and sets phase to 0.
complex operator() ()
 Iterate and return current complex output.
Tv freq ()
 Return frequency.

Public Attributes

complex val
 Current complex output.

Detailed Description

template<class Tv = gam::real, class Ts = Synced>
class gam::CSine< Tv, Ts >

Complex sinusoid oscillator.

This oscillator outputs a sine and cosine wave simultaneously. Efficiency wise, it's comparable to a non-interpolating table oscillator, but gives a quadrature (90 degree phase shifted) wave for free. The sinusoids are computed by multiplying two complex numbers to rotate a phasor. This requires only four multiplications and two additions per iteration. The main disadvantage of this oscillator is that it is expensive to change its frequency. This is implemented from Mathews, M., Smith, J. 2003. "Methods for synthesizing very high Q parametrically well behaved two pole filters."


Constructor & Destructor Documentation

CSine ( Tv  frq = 440,
Tv  amp = 1,
Tv  dcy = -1,
Tv  phs = 0 
)
Parameters:
[in]frqFrequency
[in]ampAmplitude
[in]dcyDecay time (negative means no decay)
[in]phsPhase in [0, 1)

The documentation for this class was generated from the following file: