No matching definitions.

tur/synth

src/signal/synth.tur
defn

adsr-gen

(adsr-gen [params])
defn

svf-low-pass

(svf-low-pass [cutoff :float q :float])
defn

hard-clip

(hard-clip [limit :float])
defn

voice

(voice [freq :float params gate-sig filter-cutoff :float filter-q :float])

subtractive synthesizer voice: oscillator -> filter -> envelope.

freqfrequency in Hz
paramsADSRParams for the amplitude envelope
gate-sigSignal<bool> controlling note on/off
filter-cutoffSVF cutoff frequency (normalised 0.0 to 1.0)
filter-qSVF resonance

Signal<Sample> ready to be summed into a mix bus.

(voice 440.0 (ADSRParams 0.01 0.1 0.7 0.2) gate-sig 0.6 0.5)
defn

voice-sf

(voice-sf [freq :float params filter-cutoff :float filter-q :float])

SF wrapper around voice for arrow-based composition.

freqfrequency in Hz
paramsADSRParams
filter-cutoffnormalised cutoff
filter-qresonance

SF<Tuple () bool, Sample> where the bool lane carries the gate.

defn

poly-synth

(poly-synth [voices params filter-cutoff :float filter-q :float])

polyphonic synthesizer mixing multiple voices.

voicesvector of (freq, gate-signal) tuples, one per voice
paramsADSRParams shared by all voices
filter-cutoffshared filter cutoff
filter-qshared filter resonance

Signal<Sample> summing all active voices.

(poly-synth (vec-of (Tuple 261.0 gate1) (Tuple 329.0 gate2)) params 0.6 0.4)
defn

fm-voice

(fm-voice [carrier-freq :float modulator-freq :float mod-index :float params gate-sig])

two-operator FM voice.

carrier-freqcarrier oscillator frequency in Hz
modulator-freqmodulator oscillator frequency in Hz
mod-indexmodulation index (depth of FM)
paramsADSRParams for amplitude and modulator envelopes
gate-sigSignal<bool> controlling note on/off

Signal<Sample> with FM-processed output.

(fm-voice 440.0 880.0 2.0 (ADSRParams 0.01 0.1 0.7 0.3) gate-sig)
defn

wavetable-osc

(wavetable-osc [wavetable freq :float])

wavetable oscillator with linear interpolation.

wavetablepre-computed waveform table (one cycle)
freqplayback frequency in Hz

SF<(),Sample> reading from the wavetable at the requested frequency.

((wavetable-osc (sine-wavetable 2048) 440.0) (constant ()))
defn

sine-wavetable

(sine-wavetable [size])

generate a sine-wave lookup table.

sizenumber of samples in the table

vec<Sample> containing one cycle of a sine wave.

(sine-wavetable 2048)
defn

square-wavetable

(square-wavetable [size duty])

generate a square-wave lookup table.

sizenumber of samples in the table
dutyduty cycle (0.0 to 1.0)

vec<Sample> containing one cycle of a square wave.

defn

sawtooth-wavetable

(sawtooth-wavetable [size])

generate a sawtooth-wave lookup table.

sizenumber of samples in the table

vec<Sample> containing one cycle of a sawtooth wave in [-1, 1).

defn

wavetable-voice

(wavetable-voice [wavetable freq :float params gate-sig])

wavetable oscillator with ADSR amplitude envelope.

wavetablepre-computed waveform table
freqfrequency in Hz
paramsADSRParams
gate-sigSignal<bool>

Signal<Sample>.

defn

granular

(granular [source grain-duration :float grain-rate :float randomness :float])

simple granular synthesizer creating overlapping grain clouds.

sourcesource audio signal to granulate
grain-durationduration of each grain in seconds
grain-rategrains spawned per second
randomnessposition randomisation amount (0.0 to 1.0)

Signal<Sample> mixing all active grains.

(granular my-sig 0.05 20.0 0.3)
defn

additive-voice

(additive-voice [base-freq :float harmonics params gate-sig])

additive synthesizer summing weighted harmonic sine waves.

base-freqfundamental frequency in Hz
harmonicsvector of (amplitude, frequency-multiple) tuples
paramsADSRParams for the overall amplitude envelope
gate-sigSignal<bool>

Signal<Sample> summing all harmonics, shaped by the envelope.

(additive-voice 220.0 (vec-of (Tuple 1.0 1.0) (Tuple 0.5 2.0)) params gate-sig)
defn

karplus-strong

(karplus-strong [freq :float decay :float noise-duration :float])

plucked string synthesis using a feedback delay line.

freqfundamental frequency in Hz
decaydecay factor per averaging step (close to 1.0 for long sustain)
noise-durationduration of the initial noise burst in seconds

Signal<Sample> simulating a plucked string.

(karplus-strong 261.63 0.995 0.01)
defn

ks-voice

(ks-voice [freq :float decay :float noise-duration :float params gate-sig])

Karplus-Strong string with ADSR amplitude envelope.

freqfrequency in Hz
decayper-sample decay factor
noise-durationnoise burst duration in seconds
paramsADSRParams
gate-sigSignal<bool>

Signal<Sample>.

defn

lead-synth

(lead-synth [freq :float gate-sig])

bright cutting lead synth preset.

freqfrequency in Hz
gate-sigSignal<bool>

Signal<Sample>.

defn

bass-synth

(bass-synth [freq :float gate-sig])

deep warm bass synth preset.

freqfrequency in Hz
gate-sigSignal<bool>

Signal<Sample>.

defn

pad-synth

(pad-synth [freq :float gate-sig])

soft evolving pad synth preset.

freqfrequency in Hz
gate-sigSignal<bool>

Signal<Sample>.

defn

pluck-synth

(pluck-synth [freq :float gate-sig])

Karplus-Strong plucked string preset.

freqfrequency in Hz
gate-sigSignal<bool>

Signal<Sample>.

defn

effects-chain

(effects-chain [effects input])

apply a sequence of signal processors in order.

effectsvector of SF<Sample,Sample> processors to apply
inputsource signal SF<(),Sample>

SF<(),Sample> with all effects applied in order.

(effects-chain (vec-of (gain 0.5) (low-pass 0.3)) my-osc)
defn

example-effects-chain

(example-effects-chain [input])

demonstration chain: gain -> low-pass -> hard clip.

inputsource signal SF<(),Sample>

SF<(),Sample>.

defn

step-sequencer

(step-sequencer [notes tempo gate-duration])

simple monophonic step sequencer.

notesvector of (freq, duration) tuples defining the sequence
tempoplayback tempo in beats per minute
gate-durationgate-on fraction of each note duration (0.0 to 1.0)

Signal<Sample> playing the sequence repeatedly.

(step-sequencer (vec-of (Tuple 440.0 0.25) (Tuple 550.0 0.25)) 120.0 0.8)
Internal definitions
__sample-add
__sample-mul
__sample-clip