[chuck-users] Using UGen as a function arg

Bozelos Dimitris dbozelos at yahoo.gr
Mon Aug 31 13:05:27 EDT 2009


Hello Andrew,

>> Or, is there a way to do what I want to do (build
>> more general modulation functions) within the existing framework?

if you don't mind writing some more code you might want to try the following:
(I haven't tested it but it might work)

class BaseDelay
{
    fun dur delay()
    {
    }

    fun dur delay( dur _delay )
    {
    }

    // the same for max
}

class MyDelay extends BaseDelay
{
    Delay aDelay;

    fun dur delay()
    {
        return aDelay.delay();
    }

    fun dur delay( dur _delay )
    {
        _delay => aDelay.delay;
    }

    // the same for max
}

// the same for DelayL and DelayA

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

Dimitris

--- Στις Δευτ., 31/08/09, ο/η Andrew C. Smith <acsmith at willamette.edu> έγραψε:

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
_______________________________________________
chuck-users mailing list
chuck-users at lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



      
___________________________________________________________ 
Χρησιμοποιείτε Yahoo!; 
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail 
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών 
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20090831/376e0aca/attachment.htm>


More information about the chuck-users mailing list