Debian Codegraph @

examples/stk/blowbotl2.ck

raw
1 // STK BlowBotl; using classic STK controlChange
2 // (also see blowbotl.ck)
3
4 // patch
5 BlowBotl bottle => dac;
6
7 // scale
8 [0, 2, 4, 7, 8, 11] @=> int scale[];
9
10 // infinite time loop
11 while( true )
12 {
13 Math.random2f( 0, 128 ) => float noisegain;
14 Math.random2f( 0, 128 ) => float vibratofreq;
15 Math.random2f( 0, 128 ) => float vibratogain;
16 Math.random2f( 0, 128 ) => float volume;
17
18 <<< "---", "" >>>;
19 <<< "noise gain:", noisegain, "/ 128.0" >>>;
20 <<< "vibrato freq:", vibratofreq, "/ 128.0" >>>;
21 <<< "vibrato gain:", vibratogain, "/ 128.0" >>>;
22 <<< "volume:", volume, "/ 128.0" >>>;
23
24 // noise gain
25 bottle.controlChange( 4, noisegain );
26 // vibrato freq
27 bottle.controlChange( 11, vibratofreq );
28 // vibrato gain
29 bottle.controlChange( 1, vibratogain );
30 // volume
31 bottle.controlChange( 128, volume );
32
33 // set freq
34 scale[Math.random2(0,scale.size()-1)] + 57 => Std.mtof => bottle.freq;
35 // go
36 .8 => bottle.noteOn;
37
38 // advance time
39 1::second => now;
40 }