[chuck-users] Getting Started with ChucK

Lucas Samaruga samarugalucas at gmail.com
Mon Jul 20 23:03:41 EDT 2009


I think to make the instance variables like control buses is not the
design of chuck...
but hmmm... sc have more development in high level programming
interface than ck.
If one want a custom fm class or function or a bus it can be made
within the ck logic.

>fun void mod(UGen a, UGen.etc() b) {
>    a.last => b;
>    64::samp => now;
>}
>
>Is there any way to achieve the same functionality as this?

You don't need a param, pass the entire UGen
and make use of polymorphism

//ck

fun void modula(Osc car, Osc mod, float bfreq) {
    while(true) {
        mod.last() + bfreq => car.freq;
        64::samp => now;
    }
}

SinOsc car => dac;
SinOsc mod => blackhole;

440 => float bfreq;
20 => mod.freq;
300 => mod.gain;

spork ~ modula(car, mod, bfreq);
2::second => now;

car =< dac;
SawOsc car2 => LPF lpf => dac;

2000 => lpf.freq;

spork ~ modula(car2, mod, bfreq);
2::second => now;


// sc

(
t = Task{
	var bfreq = 440;
	x = {SinOsc.ar(bfreq + SinOsc.kr(20, mul:300))}.play;
	2.wait;
	x.release;
	y = {LPF.ar(LFSaw.ar(bfreq + SinOsc.kr(20, mul:300)), 2000)}.play;
	2.wait;
	y.release;
}.play;
)

of course this can be made different in both languages. Is not a good
comparison.

greetings
Lucas


More information about the chuck-users mailing list