*** empty log message ***
[chuck-blob.git] / v2 / examples / stk / stifkarp.ck
blob30e3c544d84dcbca071037964b9a6dc3cc7355be
1 // STK StifKarp
3 // patch
4 StifKarp 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     Std.rand2f( 0, 1 ) => m.pickupPosition;
15     Std.rand2f( 0, 1 ) => m.sustain;
16     Std.rand2f( 0, 1 ) => m.stretch;
18     <<< "---", "" >>>;
19     <<< "pickup:", m.pickupPosition() >>>;
20     <<< "sustain:", m.sustain() >>>;
21     <<< "stretch:", m.stretch() >>>;
23     // factor
24     Std.rand2f( 1, 4 ) => float factor;
26     for( int i; i < notes.cap(); i++ )
27     {
28         play( Std.rand2(0,2)*12 + notes[i], Std.rand2f( .6, .9 ) );
29         100::ms * factor => now;
30     }
33 // basic play function (add more arguments as needed)
34 fun void play( float note, float velocity )
36     // start the note
37     Std.mtof( note ) => m.freq;
38     velocity => m.pluck;