Debian Codegraph @

examples/stk/bowed.ck

raw
1 // patch
2 Bowed bow => dac;
3
4 // scale
5 [0, 2, 4, 7, 8, 11] @=> int scale[];
6
7 // infinite time loop
8 while( true )
9 {
10 // set
11 Math.random2f( 0, 1 ) => bow.bowPressure;
12 Math.random2f( 0, 1 ) => bow.bowPosition;
13 Math.random2f( 0, 12 ) => bow.vibratoFreq;
14 Math.random2f( 0, 1 ) => bow.vibratoGain;
15 Math.random2f( 0, 1 ) => bow.volume;
16
17 // print
18 <<< "---", "" >>>;
19 <<< "bow pressure:", bow.bowPressure() >>>;
20 <<< "bow position:", bow.bowPosition() >>>;
21 <<< "vibrato freq:", bow.vibratoFreq() >>>;
22 <<< "vibrato gain:", bow.vibratoGain() >>>;
23 <<< "volume:", bow.volume() >>>;
24
25 // set freq
26 scale[Math.random2(0,scale.size()-1)] + 57 => Std.mtof => bow.freq;
27 // go
28 .8 => bow.noteOn;
29
30 // advance time
31 Math.random2f(.8, 2)::second => now;
32 }