*** empty log message ***
[chuck-blob.git] / v2 / examples / stk / modalbar.ck
blob85d48b84056ba5bc5ca5dd7ab77da917086a753e
1 // STK ModalBar
3 // patch
4 ModalBar bar => dac;
6 // scale
7 [0, 2, 4, 7, 8, 11] @=> int scale[];
9 // infinite time loop
10 while( true )
12     // ding!
13     Std.rand2( 0, 8 ) => bar.preset;
14     Std.rand2f( 0, 1 ) => bar.stickHardness;
15     Std.rand2f( 0, 1 ) => bar.strikePosition;
16     Std.rand2f( 0, 1 ) => bar.vibratoGain;
17     Std.rand2f( 0, 60 ) => bar.vibratoFreq;
18     Std.rand2f( 0, 1 ) => bar.volume;
19     Std.rand2f( .5, 1 ) => bar.directGain;
20     Std.rand2f( .5, 1 ) => bar.masterGain;
22     // print
23     <<< "---", "" >>>;
24     <<< "preset:", bar.preset() >>>;
25     <<< "stick hardness:", bar.stickHardness() >>>;
26     <<< "strike position:", bar.strikePosition() >>>;
27     <<< "vibrato gain:", bar.vibratoGain() >>>;
28     <<< "vibrato freq:", bar.vibratoFreq() >>>;
29     <<< "volume:", bar.volume() >>>;
30     <<< "direct gain:", bar.directGain() >>>;
31     <<< "master gain:", bar.masterGain() >>>;
33     // set freq
34         scale[Std.rand2(0,scale.cap()-1)] => int winner;
35     57 + Std.rand2(0,2)*12 + winner => Std.mtof => bar.freq;
36     // go
37     .8 => bar.noteOn;
39     // advance time
40     .5::second => now;