[chuck-users] GC vs real-time (was Getting Started with ChucK)

Hans Aberg haberg at math.su.se
Fri Jul 24 15:55:43 EDT 2009


On 24 Jul 2009, at 21:15, Stefan Blixt wrote:
> Hi!
>
> Consider this:
>
> SinOsc osc => dac;
>
> while (true) {
>   for (0 => int i; i < 10; i++) {
>     i*1000 => osc.freq;
>     1::samp => now;
>   }
> }
>
> Stuff like this can become pretty difficult to try to compute ahead,  
> since general ChucK code plays on the same timing playfield as the  
> UGens.

This is in fact interesting, because one can think of different models:

In one, one wants computations to be fully deterministic. This would  
be suitable for building a new sound generator. Then the details of  
the generator should be fully known, so that it can be computed ahead.  
Then those computations might in part be parallelized, in as much they  
do not interdepend.

In the other model, the sound generator is considered external to the  
changes made to them. This would be like a musician playing on a  
string say. The musician has control over the string, but only  
partially - the string is a parallel object. So in this case, the  
oscillator can be put into a separate thread.

> Also, consider if the for loop uses the current output value from  
> osc in its calculation, causing a compute ahead-loop. Also, I think  
> you can put the for loop in a different file than the oscillator it  
> manipulates (with some added class magic).

So this would be the same, but more complicated.

   Hans




More information about the chuck-users mailing list