Skip to main content

Module synth

Module synth 

Source
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.
BiquadFilter
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.
DelayLine
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§

FilterMode
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).