I'm not denying the logic is there. And certainly you can do certain
things in ChucK more easily that you can do them in SC. I'm just
saying that if you come from SC (or CSound) there are some things in
ChucK that may seem a little weird. And there might be some ways that
ChucK could deal with these things. But I'm not saying that ChucK is
REQUIRED to deal with them in the ways I'm talking about. I'm just
throwing out ideas.
At some point a programming language's utility is measured by it's
ability to provide an easy way to do a common task. So in the end it
depends on what you're trying to do. If you want to modulate on UGen
using some other UGens, SC gives you a fairly easy way to do this. If
you want sample-level control over your audio, ChucK might offer some
advantages.
Lucas, I agree that what I'm suggesting isn't necessarily in the
spirit of ChucK as it is currently implemented. But imagine a
situation in which the following was true:
1. Integer and Float values were objects.
2. These objects had a ".value()" method that returned the value of the object.
3. UGen objects had a ".value()" method that returned the current
value of the UGen.
As long as whatever you chucked to .freq had a ".value()" method, then
you could do what I described. Every sample, the UGen would simply
call "freq.value()" and get the current value of the frequency.
Like I said, I'm just throwing out ideas.
andy
On Mon, Jul 20, 2009 at 8:21 PM, Lucas Samaruga
sorry, add this
spork ~ modula(car, mod, bfreq) @=> Shred @modulaShred; // this 2::second => now;
car =< dac; Machine.remove(modulaShred.id()); // this
2009/7/21 Lucas Samaruga
: 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
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users