It's just the formula to calculate semitones within the equal temperatment tuning: http://en.wikipedia.org/w/index.php?title=Equal_temperament#Twelve-tone_equa... Math.pow(...) is simply the exponent .... On 08.06.2015 14:38, Casper Schipper wrote:
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;
}
On 8 jun. 2015, at 06:26, J Alexander Diaz
mailto:jalexander@diazsounds.com> wrote: *// freq*
*scale[Math.random2(0,scale.cap()-1)]=>intfreq;*
* 220.0*Math.pow(1.05946,(Math.random2(0,2)*12)+freq)=>sit.freq;*
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users