From 7eba4b20c13cd993665308b3449d473c44e130b3 Mon Sep 17 00:00:00 2001 From: Bart Brouns Date: Sat, 27 Jun 2020 18:41:07 +0200 Subject: [PATCH] add reset and phase versions of lf_sawpos --- oscillators.lib | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/oscillators.lib b/oscillators.lib index 7060f175..926f941c 100644 --- a/oscillators.lib +++ b/oscillators.lib @@ -423,7 +423,7 @@ lf_rawsaw(periodsamps) = (_,periodsamps : fmod) ~ +(1.0); // Where: // // * `freq`: frequency -// * `phase`: phase +// * `phase`: phase between 0 and 1 //--------------------------------------------------------- lf_sawpos_phase(phase,freq) = (+(phase-phase') : ma.frac) ~ +(freq/ma.SR); @@ -446,6 +446,47 @@ lf_sawpos_phase(phase,freq) = (+(phase-phase') : ma.frac) ~ +(freq/ma.SR); // MarkDown: Romain Michon lf_sawpos(freq) = ma.frac ~ +(freq/ma.SR); +//-----------------`(os.)lf_sawpos_reset`-------------------- +// Simple sawtooth waveform oscillator between 0 and 1. +// with reset. +// +// #### Usage +// +// ``` +// lf_sawpos_reset(freq,reset) +// ``` +// +// Where: +// +// * `freq`: frequency +// * `reset`: reset the oscillator to 0 +// +//--------------------------------------------------------- +// Author: Bart Brouns +// License: STK-4.3 +lf_sawpos_reset(freq,reset) = ma.frac * (reset == 0) ~ +(freq/ma.SR) + +//-----------------`(os.)lf_sawpos_phase_reset`-------------------- +// Simple sawtooth waveform oscillator between 0 and 1. +// with phase control and reset. +// +// #### Usage +// +// ``` +// lf_sawpos_phase_reset(freq,phase,reset) +// ``` +// +// Where: +// +// * `freq`: frequency +// * `phase`: phase between 0 and 1 +// * `reset`: reset the oscillator to 0 +// +//--------------------------------------------------------- +// Author: Bart Brouns +// License: STK-4.3 +lf_sawpos_phase_reset(freq,phase,reset) = lf_sawpos_reset(freq,reset) +phase :ma.frac; + //-----------------`(os.)lf_saw`-------------------- // Simple sawtooth waveform. // `lf_saw` is a standard Faust function.