ChucK/Examples/Lfo1

From CSWiki
Revision as of 13:00, 3 August 2007 by Gasten (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is how you can create a simple LFO-Envelope on the frequency for your sine wave.

SinOsc s => Gain g => dac;
SinOsc lfo => blackhole; // Make the ugen calculate new samples, but don't send them to the dac.

1.0 => lfo.freq;   // number off times the lfo should complete it's cycle each second
300 => lfo.gain;   // How the lfo should oscillate (here: from -300 to 300)

0.2 => g.gain;

// Change samp to something else (like 50::ms) for a glitchier effect.
while(samp => now) {
    lfo.last() + 900.0 => s.freq;   // Here we add the last value of lfo and a little booster.
}


The frequecy will vary between 600 (900 + (-300)) and 1200 (900 + 300).

Note that -all- sample-producing ugens got a last()-function that will return the last sample the ugen spit out. This defaults to a float between -1.0 to 1.0.