// Simple tabulated sine LFO // compute and fill table only once // P. Cook, March 2013 class LFO extends Chugen { 8 => int VECT; float sine[VECT]; 0.01 => float myFreq; 0.0 => float count; for (0 => int i; i < VECT; i++) Math.sin(2*pi/VECT*i) => sine[i]; fun float tick(float input) { // here we ignore the input myFreq +=> count; while (count >= VECT) VECT -=> count; count $ int => int counter; return sine[counter]; } fun void freq(float aFreq) { aFreq * VECT / (1.0 :: second / 1.0 :: samp) => myFreq; } } Step stp => Gain freq => SinOsc s => dac; LFO lfo => freq; 1.0 => stp.next; 6.0 => lfo.freq; 0.05 => lfo.gain; 2 => s.sync; 300.0 => freq.gain; 1.0 :: second => now; 400.0 => freq.gain; 1.0 :: second => now; 500.0 => freq.gain; 1.0 :: second => now;