Expand description
DSP synthesis — oscillators, biquad filters, LFOs, FM synthesis, and effects chain.
All sample-rate math uses the engine’s fixed sample rate (48 kHz by default). Every component is designed to be sample-accurate and allocation-free per sample.
Structs§
- Adsr
- ADSR envelope generator. Produces a gain value in [0, 1] from a note timeline.
- Biquad
Filter - Biquad (second-order IIR) filter — used for low-pass, high-pass, resonant, etc.
- DcBlocker
- DC blocker (high-pass at ~10 Hz) to prevent offset accumulation.
- Delay
Line - Simple delay line for reverb/echo effects.
- Echo
- Feedback delay (echo) effect.
- FmOperator
- A single FM synthesis operator (carrier or modulator).
- FmVoice
- A simple 2-op FM synthesis voice: modulator → carrier.
- Lfo
- Low-frequency oscillator for modulating parameters.
- Oscillator
- A stateful oscillator that tracks its phase across samples.
- Reverb
- Schroeder-style mono reverb using 4 comb + 2 allpass filters.
- Saturator
- Soft-clipping saturator / waveshaper.
Enums§
- Filter
Mode - Biquad filter type.
- Waveform
- Basic oscillator waveforms.
Constants§
- DIMINISHED
- Diminished (half-whole) scale.
- MAJOR_
SCALE - Major scale intervals in semitones.
- MINOR_
SCALE - Natural minor scale intervals.
- PENTATONIC_
MAJ - Pentatonic major intervals.
- PENTATONIC_
MIN - Pentatonic minor intervals.
- SAMPLE_
RATE - SAMPLE_
RATE_ INV - WHOLE_
TONE - Whole tone scale.
Functions§
- chord_
freqs - Build a chord as frequencies given a root note (MIDI), scale intervals, and chord degrees.
- db_
to_ linear - Convert dB to linear gain.
- detune_
cents - Detune a frequency by
cents(100 cents = 1 semitone). - hz_
to_ midi - Convert frequency to nearest MIDI note number.
- linear_
to_ db - Convert linear gain to dB.
- midi_
to_ hz - Convert a MIDI note number to a frequency in Hz.
- oscillator
- Generate one sample from a waveform at a given phase [0, 1).