08_02_02 - Modulation System¶
Sistema de modulación sample-accurate para parámetros.
Components¶
ModulationMatrix¶
- Routing N sources → M targets
- Per-routing depth control
- Bipolar/unipolar modes
- Enable/disable individual routings
LFO (Low Frequency Oscillator)¶
Waveforms: - Sine - Triangle - Saw - Square - Sample & Hold - Noise
Features: - Tempo sync - Phase control - Sample-accurate
Envelope¶
Type: ADSR (Attack, Decay, Sustain, Release)
Features: - Per-stage timing control - Note on/off triggering - Stage detection - Sample-accurate
SampleAccurateInterpolator¶
Modes: - Linear - Exponential - S-Curve - Immediate (no ramp)
Use: Smooth parameter changes to avoid clicks
Usage Example¶
// Create modulation sources
LFO lfo(44100.0);
lfo.setWaveform(LFO::Waveform::Sine);
lfo.setFrequency(2.0f);
Envelope env(44100.0);
env.setAttack(0.01f);
env.setDecay(0.1f);
env.setSustain(0.7f);
env.setRelease(0.3f);
// Setup modulation matrix
ModulationMatrix matrix;
matrix.registerSource("lfo1", &lfo);
matrix.registerSource("env1", &env);
// Route LFO to cutoff
matrix.addRouting({"lfo1", "cutoff", 0.5f, true});
// Route envelope to gain
matrix.addRouting({"env1", "gain", 1.0f, false});
// Process
env.noteOn();
matrix.process(512);
Performance¶
- Sample-accurate modulation
- Zero allocations in process loop
- Optimized waveform generation
- Minimal CPU overhead
Status¶
✅ COMPLETADO (Fase ⅗)