[chuck-users] Feature ideas

pibsid at suomi24.fi pibsid at suomi24.fi
Sat May 24 08:48:48 EDT 2008


I'm learning some Python now and I really like it.
Aside my dreams of a complete PyChucK ;) I'd really like to have duck 
typing in ChucK.
http://en.wikipedia.org/wiki/Duck_typing

Here's an example of what I mean:

//Let's define the following UGens:
SinOsc sin;
TriOsc tri;
Mandolin man;

//A very simple function for setting the frequency to 300 Hz
//If we want to use it with the UGens we've defined we'll need three 
different versions:

fun void setFreq( SinOsc sinosc ){ 300.0 => sinosc.freq; }
fun void setFreq( TriOsc triosc ){ 300.0 => triosc.freq; }
fun void setFreq( StkInstrument stkinstrument ){ 300.0 => 
stkinstrument.freq; }

//With duck typing we would only need one:

fun void setFreq( ugen ){ 300.0 => ugen.freq; }

//end of example

What do you think, would this be a nice feature to have? Is there a 
reason why is ChucK is so strongly typed?


Another feature that I'd like to see is score timing that supports 
tempo changes. With the basic timing scheme things go easily out of 
sync if you change the tempo on the fly.

So I'm asking for global tempo control, score duration ( sdur ), score 
time ( stime ) and score now ( snow ).
The type sdur would measure beats in quarternote durations.
The type stime is an absolute measure of score duration.
snow holds the current score time measured in quarternote beats.

So calling:
12::whole => snow;
would advance score time by 12 whole notes and take tempo changes that 
other shreds might make in to account.

I know this might unnecessarily complicate ChucK and similar score 
timing scheme can already be made in ChucK as it is (using floats 
instead of sdurs).

I'm posting to the list to get some discussion and feedback before 
wikifying these feature request.

-Pyry Pakkanen ( Frostburn )


More information about the chuck-users mailing list