Computed sine wave oscillator. More...
#include <Oscillator.h>
Public Member Functions | |
Sine (Tv frq=440, Tv phs=0) | |
Tv | operator() (Tv frqOffset=Tv(0)) |
Generate next sample with a frequency offset. | |
Tv | nextPhase () |
Generate next sample. Stored phase is post-incremented. | |
Tv | nextPhase (Tv frqOffset) |
Generate next sample with a frequency offset. | |
void | freq (Tv v) |
Set frequency. | |
Tv | freq () |
Get frequency. | |
void | period (Tv v) |
Set period length. | |
Tv | period () |
Get period. | |
void | phase (Tv v) |
Set phase from [0, 1) of one period. | |
Tv | phase () |
Get normalized phase in [0, 1) | |
void | phaseAdd (Tv v) |
Add value to unit phase. |
Computed sine wave oscillator.
This oscillator uses a 7th order Taylor series approximation to compute sine values. Computation time is about as much as a linearly-interpolating table lookup. In most cases, Taylor series are also more spectrally pure than table lookup methods since the distortion arises as harmonics.
Sine | ( | Tv | frq = 440 , |
Tv | phs = 0 |
||
) |
[in] | frq | Frequency |
[in] | phs | Phase in [0, 1) |