No matching definitions.

signal/osc

src/signal/osc.tur
defn

sine

(sine [freq :float phase :float])

sine-wave oscillator Signal Function.

freqfrequency in Hz
phaseinitial phase offset in radians

An SF: ignores its input signal and emits sin(2*pi*freq*t + phase).

(sine 440.0 0.0)
defn

square

(square [freq :float dutycycle :float])

square-wave oscillator Signal Function.

freqfrequency in Hz
dutycycleduty cycle in [0, 1]

An SF emitting +1.0 for the on-portion of each cycle, -1.0 otherwise.

(square 220.0 0.5)
defn

sawtooth

(sawtooth [freq :float])

sawtooth-wave oscillator Signal Function.

freqfrequency in Hz

An SF emitting a rising ramp in [0.0, 1.0).

(sawtooth 110.0)
defn

triangle

(triangle [freq :float])

triangle-wave oscillator Signal Function.

freqfrequency in Hz

An SF that rises from -1.0 to 1.0 over the first half of each cycle and falls back to -1.0 over the second.

(triangle 440.0)
defn

pm-sine

(pm-sine [freq :float])

phase-modulated sine: sin(2*pi*freq*t + m(t)).

freqcarrier frequency in Hz

SF Sample Sample: modulator (radians) -> modulated carrier.

((pm-sine 440.0) ((gain 2.0) ((sine 110.0 0.0) (constant 0.0))))
defn

fm-sine

(fm-sine [sample-rate :float freq :float])

frequency-modulated sine: instantaneous frequency freq + m(t).

sample-ratethe rate the result will be sampled at, in Hz
freqcarrier frequency in Hz

SF Sample Sample: modulator (Hz) -> modulated carrier.

((fm-sine 48000.0 440.0) ((gain 220.0) ((sine 110.0 0.0) (constant 0.0))))
Internal definitions
__dsp_sin-- compute sine of angle in radians.
__dsp_fmod-- compute floating-point modulo.
__fm_alloc-- allocate an FM phase cell: [phase, previous freq, started].
__fm_step-- advance the FM phase by one sample and return its sine.