Hi, I think you meant to put the frequency generation inside of the loop? Also, why don't you add some more steps to your 'scale' array ?
For converting pitches: Std.mtof converts midi-values (ranged 0-128, 69 being A4) to standard tempered scale frequencies, bypassing your need to use Math.pow etc...
You could just do: 69 => Std.mtof => sit.freq
You may want to read the ChucK manual, which covers the basics much better then I could explain in a single email !
Happy chucking,
Casper
// Sitar
Sitar sit => JCRev r => Echo a => dac;
// gain
.56 => r.gain;
// reverb mix
1.12 => r.mix;
// max delay for echo
1120::ms => a.max;
// set delay for echo
112::ms => a.delay;
// initial effect mix
0.0 => a.mix;
// scale
[ 1,5,6,7,15 ] @=> int scale[];
// loop
while( true ){
// freq
scale[Math.random2(0,scale.cap()-1)] => int freq;
220.0 * Math.pow( 1.05946, (Math.random2(0,2)*12) + freq ) => sit.freq;
//pluck
Math.random2f( 0.1, 0.9 ) => sit.noteOn;
//time
Math.random2f( .01, 1000 )::ms => now;
}
// freq
scale[Math.random2(0,scale.cap()-1)] => int freq;
220.0 * Math.pow( 1.05946, (Math.random2(0,2)*12) + freq ) => sit.freq;