#include <envelopes.h>
An LFO based on cubic segments.
You can randomise the rate and/or the depth. Randomising the depth past 0.5
means it no longer neatly alternates sides:
Without randomisation, it is approximately sine-like:
Methods | |
CubicLfo (long seed) | |
void | reset () |
Resets the LFO state, starting with random phase. More... | |
void | set (float low, float high, float rate, float rateVariation=0, float depthVariation=0) |
Smoothly updates the LFO parameters. More... | |
float | next () |
Returns the next output sample. More... | |
|
inline |
Returns the next output sample.
|
inline |
Resets the LFO state, starting with random phase.
|
inline |
Smoothly updates the LFO parameters.
If called directly after .reset()
, oscillation will immediately start within the specified range. Otherwise, it will remain smooth and fit within the new range after at most one cycle:
The LFO will complete a full oscillation in (approximately) 1/rate
samples. rateVariation
can be any number, but 0-1 is a good range.
depthVariation
must be in the range [0, 1], where ≤ 0.5 produces random amplitude but still alternates up/down.