Low-frequency oscillator (non band-limited). More...
#include <Oscillator.h>
Public Member Functions | |
| LFO (float frq, float phase=0, float mod=0.5) | |
| LFO & | set (float f, float p, float m) |
| Set frequency, phase and modifier amount. | |
| LFO & | mod (double n) |
| Sets modifier parameter of waveform from unit value. | |
| float | cos () |
| Cosine based on 3rd order polynomial. | |
| float | down () |
| Downward ramp (1 to -1) | |
| float | even3 () |
| Even harmonic sine-like wave (3rd order) | |
| float | even5 () |
| Even harmonic sine-like wave (5th order) | |
| float | imp () |
| Impulse (occurs at beginning of cycle) | |
| float | line2 () |
| 2-segment line. mod changes wave from down to tri to up | |
| float | para () |
| Parabolic wave (triangle wave with all harmonics) | |
| float | pulse () |
| Pulse (up + down). 'mod' controls pulse width. | |
| float | sinPara () |
| Sine-like wave constructed from parabolas (odd harmonics) | |
| float | stair () |
| Stair (square + square). 'mod' controls pulse width. | |
| float | sqr () |
| Square (-1 to 1) | |
| float | tri () |
| Triangle (starts at 1 goes down to -1 then up to 1) | |
| float | up () |
| Upward ramp. | |
| float | up2 () |
| Dual upward ramp (up + up). 'mod' controls pulse width. | |
| float | cosU () |
| Unipolar cosine based on 3rd order polynomial. | |
| float | downU () |
| Unipolar downward ramp. | |
| float | hann () |
| Hann window. | |
| float | line2U () |
| Unipolar line2. | |
| float | paraU () |
| Unipolar parabolic wave. | |
| float | pulseU () |
| Unipolar pulse. | |
| float | stairU () |
| Unipolar stair. | |
| float | sqrU () |
| Unipolar square. | |
| float | triU () |
| Unipolar triangle (starts at 1 going down then up) | |
| float | upU () |
| Unipolar upward ramp. | |
| float | up2U () |
| Unipolar upward ramp2. | |
| void | freq (float v) |
| Set frequency. | |
| float | freq () const |
| Get frequency. | |
| void | phase (float v) |
| Set phase from [0, 1) of one period. | |
| float | phase () const |
| Get phase in [0, 1) | |
| void | phaseMax () |
| Set phase to maximum value. | |
| void | phaseAdd (float v) |
| Add value to phase [0, 1) | |
| void | period (float v) |
| Set period length. | |
| void | reset () |
| Reset phase accumulator. | |
| bool | done () const |
| Returns true if tap is done. | |
| uint32_t | freqI () const |
| Get fixed-point frequency. | |
| float | freqUnit () const |
| Get frequency in [0, 1) | |
| uint32_t | phaseI () const |
| Get fixed-point phase. | |
| uint32_t | cycle () |
| Returns 0x80000000 on phase wrap, 0 otherwise. | |
| uint32_t | operator() () |
| Alias of cycle() | |
| uint32_t | nextPhase () |
| Increment phase and return pre-incremented phase. | |
| uint32_t | nextPhasePost () |
| Increment phase and return post-incremented phase. | |
| uint32_t | cycles () |
| Get 1 to 0 transitions of all accumulator bits. | |
Public Attributes | |
| uint32_t | modi |
| Modifier parameter. | |
Low-frequency oscillator (non band-limited).
This object generates various waveform types by mapping the output of a an accumulator through mathematical functions.
| LFO | ( | float | frq, |
| float | phase = 0, |
||
| float | mod = 0.5 |
||
| ) |
| [in] | frq | Frequency |
| [in] | phase | Phase in [0, 1) |
| [in] | mod | Modifier amount in [0, 1) |
| uint32_t cycle | ( | ) | [inherited] |
Returns 0x80000000 on phase wrap, 0 otherwise.
The return value can be used as a bool. It's an integer because it saves a conditional check converting to a bool.