Debian Codegraph @

examples/stk/blowbotl.ck

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