Hi, I've discovered chuck only a few days ago so I'm working through tutorials. Today I tried the following code from Graham Coleman's tutorial http://www.iua.upf.es/~gcoleman/chuck/tutorial/tutorial.html //connect a plucked string to the soundcard out StifKarp inst => dac; [0,2,3,1,4,2,6,3,4,4] @=> int mel[]; //sequence data for (0=>int i; ; i++) { //infinite loop std.mtof( 48 + mel[i%mel.cap()] ) => inst.freq; //set the note inst.noteOn( 0.5 ); //play a note at half volume 300::ms => now; //compute audio for 0.3 sec } This crashes chuck (v 1.2.1.3) at the "for" loop line. The code presumably used to work. Has the language changed or is this a simple bug? Thanks, -Steve
hi,
The issue is indeed in the for loop with the missing loop control, im
not sure if it would ever have worked.
When I need infinite loops I prefer while loops so rewritten with a
while loop could be
//connect a plucked string to the soundcard out
StifKarp inst => dac;
[0,2,3,1,4,2,6,3,4,4] @=> int mel[]; //sequence data
0 => int i;
while(1) { //infinite loop
i++;
Std.mtof( 48 + mel[i%mel.cap()] ) => inst.freq; //set the note
inst.noteOn( 0.5 ); //play a note at half volume
300::ms => now; //compute audio for 0.3 sec
}
also std and has been changed to Std
All the best and Happy New Year all
Scott
2010/1/1 Steve M. Robbins
Hi,
I've discovered chuck only a few days ago so I'm working through tutorials. Today I tried the following code from Graham Coleman's tutorial http://www.iua.upf.es/~gcoleman/chuck/tutorial/tutorial.html
//connect a plucked string to the soundcard out StifKarp inst => dac;
[0,2,3,1,4,2,6,3,4,4] @=> int mel[]; //sequence data
for (0=>int i; ; i++) { //infinite loop std.mtof( 48 + mel[i%mel.cap()] ) => inst.freq; //set the note inst.noteOn( 0.5 ); //play a note at half volume 300::ms => now; //compute audio for 0.3 sec }
This crashes chuck (v 1.2.1.3) at the "for" loop line. The code presumably used to work. Has the language changed or is this a simple bug?
Thanks, -Steve
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux)
iD8DBQFLPg6g0i2bPSHbMcURAhMeAJ4wJy5an39cfsJrgWHawgrn/fL8XwCgsNTN 9CVd6F1SFuPF7VpdVd+4Fhk= =osrV -----END PGP SIGNATURE-----
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (2)
-
Scott Hewitt
-
Steve M. Robbins