*** empty log message ***
[chuck-blob.git] / v2 / examples / stk / mandolin.ck
blob832245307fe04d80e19931e748872cbfc3e89b85
1 // STK Mandolin
3 // patch
4 Mandolin m => JCRev r => dac;
5 .75 => r.gain;
6 .05 => r.mix;
8 // our notes
9 [ 61, 63, 65, 66, 68, 66, 65, 63 ] @=> int notes[];
11 // infinite time-loop
12 while( true )
14     // set
15     Std.rand2f( 0, 1 ) => m.bodySize;
16     Std.rand2f( 0, 1 ) => m.pluckPos;
17     // Std.rand2f( 0, 1 ) => m.stringDamping;
18     // Std.rand2f( 0, 1 ) => m.stringDetune;
20     // print
21     <<< "---", "" >>>;
22     <<< "body size:", m.bodySize() >>>;
23     <<< "pluck position:", m.pluckPos() >>>;
24     <<< "string damping:", m.stringDamping() >>>;
25     <<< "string detune:", m.stringDetune() >>>;
27     // factor
28     Std.rand2f( 1, 4 ) => float factor;
30     for( int i; i < notes.cap(); i++ )
31     {
32         play( Std.rand2(0,2)*12 + notes[i], Std.rand2f( .6, .9 ) );
33         100::ms * factor => now;
34     }
37 // basic play function (add more arguments as needed)
38 fun void play( float note, float velocity )
40     // start the note
41     Std.mtof( note ) => m.freq;
42     velocity => m.pluck;