LFOs and Blackholes

by Adam Tindale

A common technique to add variation to synthesis is modulation. Modulation is the process of changing something, usually the parameter of a signal like frequency. A Low Frequency Oscillator (LFO) is typically used for this task because the variations are fast enough to be interesting, yet slow enough to be perceptible. When a signal is modulated quickly (ie. over 20Hz or so) it tends to alter the timbre of the signal rather than add variation.

Ok, let’s use this idea. What we need to do is set up two oscillators and have one modulate a parameter of another. ChucK does not support the connection of Ugen signal outputs to parameter inputs. This piece of code will not work:

SinOsc s => dac;
SinOsc lfo => s.freq;

Foiled. What we need to do is poll our lfo at some rate that we decide on, for now we will update the frequency of s every 20 milliseconds. Remember that a SinOsc oscillates between -1 and 1, so if we just put that directly to the frequency of s we wouldn’t be able to hear it (unless you are using ChucK in a tricked out civic). What we are going to do is multiply the output of the lfo by 10 and add it to the frequency 440. The frequency will now oscillate between 430 and 450.

SinOsc s => dac;
SinOsc lfo;
// set the frequency of the lfo
5 => lfo.freq;
while (20::ms => now)
     ( lfo.last() * 10 ) + 440 => s.freq;

ChucK is a smart little devil. This didn’t work and now we will look into the reason. Why? Ugens are connected in a network and usually passed to the dac. When a patch is compiled ChucK looks at what is connected to the dac and as each sample is computed ChucK looks through the network of Ugens and grabs the next sample. In this case, we don’t want our Ugen connected to the dac, yet we want ChucK to grab samples from it. Enter blackhole: the sample sucker. If we connect our lfo to blackhole everything will work out just fine.

SinOsc lfo => blackhole;

Play around with this patch in its current form and find interesting values for the poll rate, lfo frequency and the lfo amount. Try changing the Ugens around for more interesting sounds as well.