Debian Codegraph @

examples/basic/envelope.ck

raw
1 // run white noise through envelope
2 Noise n => Envelope e => dac;
3
4 // infinite time-loop
5 while( true )
6 {
7 // random choose rise/fall time
8 Math.random2f(10,500)::ms => dur t => e.duration;
9 // print
10 <<< "rise/fall:", t/ms, "ms" >>>;
11
12 // key on - start attack
13 e.keyOn();
14 // advance time by 800 ms
15 800::ms => now;
16 // key off - start release
17 e.keyOff();
18 // advance time by 800 ms
19 800::ms => now;
20 }