Skip to main content

Crate prime_osc

Crate prime_osc 

Source
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§

AdsrParams
ADSR envelope parameters. All times in seconds.
AdsrState
ADSR envelope state. Thread forward with each call to adsr_step.

Enums§

AdsrStage
ADSR envelope stage.

Functions§

adsr_step
Advance ADSR envelope by one time step — pure LOAD + COMPUTE.
lfo_cosine
Cosine LFO. phase in [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).