Expand description
prime-osc — Oscillators and envelopes.
All public functions are LOAD + COMPUTE. No STORE. No JUMP. State threads forward as an explicit parameter. Same inputs → same output.
Structs§
- Adsr
Params - ADSR envelope parameters. All times in seconds.
- Adsr
State - ADSR envelope state. Thread forward with each call to
adsr_step.
Enums§
- Adsr
Stage - ADSR envelope stage.
Functions§
- adsr_
step - Advance ADSR envelope by one time step — pure LOAD + COMPUTE.
- lfo_
cosine - Cosine LFO.
phasein [0, 1] maps to one full cycle. - lfo_
sawtooth - Sawtooth wave at normalised phase (rising).
- lfo_
sine - Sine wave at normalised phase.
- lfo_
square - Square wave at normalised phase.
- lfo_
triangle - Triangle wave at normalised phase. Phase-aligned with lfo_sine (peak at 0.25).
- osc_
step - Advance oscillator phase by one sample and return (sample, new_phase).