[chuck-users] Looping

Alberto Alassio alberto.alassio at gmail.com
Tue Sep 25 15:36:17 EDT 2012


I cannot understand how the while structure has to be used. I mean, I
understood that while ( true ) means infinite loop
and also that while ( n::second => now ) means an "n" second loop duration
but...

If I just want to do a really stupid thing like a Sine at 220 Hz that
sounds for 2 seconds and then stops for 2 seconds and then goes again.
How could I do? I thought that it was necessary just to do something like
this

SinOsc s => dac;
.2 => s.gain;
220 => s.freq;
while ( 2::second => now)
0 =>s.gain

but I know that it's not the right way, also because in this method I would
have to rewrite this thing an infinite ( whiletrue ahahah) number of times
to have what I'm looking for.

And I don't actually understand {} . How am I supposed to use these?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20120925/b2332dd7/attachment.html>


More information about the chuck-users mailing list