Discrete summation formula (DSF) oscillator. More...
#include <Oscillator.h>
Public Member Functions | |
| DSF (Tv frq=440, Tv freqRatio=1, Tv ampRatio=0.5, Tv harmonics=8) | |
| Tv | operator() () |
| Generate next sample. | |
| void | ampRatio (Tv v) |
| Set amplitude ratio of partials. | |
| void | antialias () |
| Adjust harmonics so partials do not alias. | |
| void | freq (Tv v) |
| Set frequency of fundamental. | |
| void | freqRatio (Tv v) |
| Set frequency ratio of partials. | |
| void | harmonics (Tv v) |
| Set number of harmonics. | |
| void | harmonicsMax () |
| Set number of harmonics to fill Nyquist range. | |
| Tv | ampRatio () |
| Get amplitude ratio. | |
| Tv | freqRatio () |
| Get frequency ratio. | |
| Tv | harmonics () |
| Get current number of harmonics. | |
| Tv | maxHarmonics () |
| Get maximum number of harmonics for current settings. | |
| Tv | nextPhase () |
| Generate next sample. Stored phase is post-incremented. | |
| Tv | nextPhase (Tv frqOffset) |
| Generate next sample with a frequency offset. | |
| 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. | |
Discrete summation formula (DSF) oscillator.
This produces a finite set of harmonics whose amplitudes follow a geometric series. The amplitude of harmonic i is ar^i where 'ar' is called the amplitude ratio. The frequency of harmonic i is (i * fr + 1) where 'fr' is called the frequency ratio. Harmonics run from i=0 (the fundamental) to the maximum specified harmonic.
| DSF | ( | Tv | frq = 440, |
| Tv | freqRatio = 1, |
||
| Tv | ampRatio = 0.5, |
||
| Tv | harmonics = 8 |
||
| ) |
| [in] | frq | Frequency |
| [in] | freqRatio | Frequency ratio of partials |
| [in] | ampRatio | Amplitude ratio of partials |
| [in] | harmonics | Number of harmonics |