Band-limited square wave. More...
#include <Oscillator.h>
Public Member Functions | |
Square (Tv frq=440, Tv phs=0) | |
Tv | operator() (Tv intg=0.997) |
Generate next sample. | |
void | freq (Tv v) |
Set frequency. | |
Tv | freq () |
Get frequency. | |
void | antialias () |
Adjust number of harmonics to prevent aliasing. | |
void | harmonics (Tv num) |
Set number of harmonics. | |
void | harmonicsMax () |
Set number of harmonics to fill Nyquist range. | |
Tv | operator() () |
Returns next sample of all harmonic impulse. | |
Tv | odd () |
Returns next sample of odd harmonic impulse. | |
Tv | saw (Tv intg=0.997) |
Returns next sample of saw waveform. | |
Tv | square (Tv intg=0.997) |
Returns next sample of square waveform. | |
Tv | maxHarmonics () |
Get number of harmonics below Nyquist based on current settings. | |
Tv | nextPhase () |
Generate next sample. Stored phase is post-incremented. | |
Tv | nextPhase (Tv frqOffset) |
Generate next sample with a frequency offset. | |
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. |
Band-limited square wave.
This produces a Fourier representation of a square wave where the number of harmonics is adjusted automatically to prevent aliasing. Due to numerical issues, this generator should not be used for producing very low frequency modulation signals. For that purpose, it is better to use the LFO class.
Square | ( | Tv | frq = 440 , |
Tv | phs = 0 |
||
) |
[in] | frq | Frequency |
[in] | phs | Phase, in [0, 1) |
Tv operator() | ( | Tv | intg = 0.997 | ) |
Generate next sample.
[in] | itg | Integration amount |