[chuck-users] Using UGen as a function arg

Andrew C. Smith acsmith at willamette.edu
Sun Aug 30 23:54:07 EDT 2009


Hey everyone,

I just found out that you could use more specific classes as function
arguments (I know, a little slow).  So, I've got:

fun void modulator (UGen a, DelayL b)
...
while(1) {
a.last()::ms => b.delay;
1::samp => now;
}

and it totally works!  Here's the catch: is there a way to make
something like this that will work for more general classes?  I mean,
why don't DelayL and DelayA and Delay all inherit from some more
general class that uses a dummy "delay" and "max" argument, so that we
can build some awesome functions that have universal applications?
There could be an oscillator class to encompass everything with a
freq, phase, and sync attribute, and so many others that would make
modulating so much easier.

I expect there to be a totally reasonable answer, because I don't
really know much about programming at all, but this seems like it
would make sense.  Or, is there a way to do what I want to do (build
more general modulation functions) within the existing framework?  I'd
ideally like something that can spork a shred to modulate a random
parameter, then fade out at the end, so that it's like the signal is
receiving random interference that makes it ring mod or something.  I
can probably figure out how to do it with millions of lines of code,
but the more work it is the less likely it is that I'll finish it.
Thanks everyone.

Andrew


More information about the chuck-users mailing list