I knew I was going to get to this eventually; I have always wanted to be able to ChucK a ugen to a parameter, similar to control voltages in modular synths I suppose. With this public class Module extends Chugen { Gain _cv; { _cv => blackhole; } fun float tick(float in) { return tick(in, _cv.last()); } // subclasses override this function fun float tick(float in, float cv) { return in; } } I can do this, which interpolates the cv to a frequency between 2.0 and 8.0 class SinModule extends Module { SinOsc sin; { sin => blackhole; } fun float tick(float in, float cv) { Interpolate.linear(cv, -1.0, 1.0, 2.0, 8.0) => sin.freq; return sin.last(); } } and then this, which uses a SinOsc at a frequency of 0.25 as the cv to modulate the frequency of the SinModule which modulates the gain for a tremolo effect. class TremoloModule extends Module { SinModule gainLfo; SinOsc rateLfo; { 1.0 => gainLfo.sin.gain; gainLfo => _cv; 0.25 => rateLfo.freq; 1.0 => rateLfo.gain; rateLfo => gainLfo._cv; } fun float tick(float in, float cv) { Interpolate.linear(cv, -1.0, 1.0, 0.0, 1.0) => gain; return in; } } SinOsc sin => TremoloModule trem => dac; 0.4 => sin.gain; 220.0 => sin.freq; 1::hour => now; https://github.com/heuermh/lick/blob/master/examples/moduleExample.ck I am wondering if others have cleaner ways of doing this, because this example isn't even easy for me to follow. michael
participants (1)
-
Michael Heuer