Multi-Segment Envelope Generator (MSEG) for complex modulation curves.
MSEG provides a sophisticated LFO/envelope generator with multiple breakpoints and adjustable curves between them. Each segment can have independent curve shaping, allowing for complex modulation patterns beyond simple LFO waveforms.
Key Features:
- Configurable breakpoints (up to maxPoints, default 200)
- Curve shaping between points (exponential/logarithmic)
- Loop mode with definable start/end points
- Delay and fade-in on note-on
- Depth and offset controls
- Phase control for starting position
- ValueTree serialization for preset saving
Each Point has:
- time: Position in the cycle (0.0 to 1.0)
- value: Output value at this point (-inf to +inf, typically -1 to 1)
- curve: Curve shape (-inf to +inf, 0=linear, positive=exponential, negative=logarithmic)
Parameters:
- frequency: Rate in Hz (for looping mode)
- phase: Starting phase (0.0 to 1.0)
- offset: DC offset added to output
- depth: Output scaling factor
- delay: Initial delay before envelope starts (seconds)
- fade: Fade-in time (seconds)
- loop: Enable looping between start/end points
Usage:
mseg.setSampleRate(44100.0);
msegData.
points[0] = {0.0f, 0.0f, 0.0f};
msegData.
points[1] = {0.2f, 1.0f, 2.0f};
msegData.
points[2] = {0.8f, 0.5f, -1.0f};
msegData.
points[3] = {1.0f, 0.0f, 0.0f};
MSEG::Parameters params;
mseg.setParameters(params);
mseg.noteOn();
float modValue = mseg.process(numSamples);
MSEG(Data &d)
Definition gin_mseg.h:156
int numPoints
Definition gin_mseg.h:95
juce::Array< Point > points
Definition gin_mseg.h:94
int endIndex
Definition gin_mseg.h:98
int startIndex
Definition gin_mseg.h:97
bool loop
Definition gin_mseg.h:82
float depth
Definition gin_mseg.h:81
float offset
Definition gin_mseg.h:81
float frequency
Definition gin_mseg.h:81
- See also
- StepLFO, LFO, AnalogADSR