signal/osc
src/signal/osc.tur
defn
sine
(sine [freq :float phase :float])
sine-wave oscillator Signal Function.
Parameters
| freq | frequency in Hz | |
| phase | initial phase offset in radians |
Returns
An SF: ignores its input signal and emits sin(2*pi*freq*t + phase).
Example
(sine 440.0 0.0)
defn
square
(square [freq :float dutycycle :float])
square-wave oscillator Signal Function.
Parameters
| freq | frequency in Hz | |
| dutycycle | duty cycle in [0, 1] |
Returns
An SF emitting +1.0 for the on-portion of each cycle, -1.0 otherwise.
Example
(square 220.0 0.5)
defn
sawtooth
(sawtooth [freq :float])
sawtooth-wave oscillator Signal Function.
Parameters
| freq | frequency in Hz |
Returns
An SF emitting a rising ramp in [0.0, 1.0).
Example
(sawtooth 110.0)
defn
triangle
(triangle [freq :float])
triangle-wave oscillator Signal Function.
Parameters
| freq | frequency in Hz |
Returns
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.
Example
(triangle 440.0)
Internal definitions
__dsp_sin-- compute sine of angle in radians.__dsp_fmod-- compute floating-point modulo.