Debian Codegraph @

examples/class/try.ck

raw
1 // uses the Dinky class
2 // (run dinky.ck before running this, for now...)
3 //
4 // > chuck dinky try
5 //
6 // NOTE (2003): in a future version of chuck...
7 // 1. we will have better dependency/include system
8 // 2. we can extend Dinky from UGen, so we don't have
9 // to use a 'connect( UGen )' function in Dinky
10 // NOTE (2013): the above (#2) is now possible using Chugraphs!
11 // check out: extend/chugraph.ck
12 // NOTE (2023): actually updated dinky.ck and this example
13 // to use Chugraphs
14
15 // connect the rest of the patch
16 Dinky dinky => Gain g => NRev r => Echo e => Echo e2 => dac;
17 // direct/dry
18 g => dac;
19 e => dac;
20
21 // set up delay, gain, and mix
22 1500::ms => e.max => e.delay;
23 3000::ms => e2.max => e2.delay;
24 1 => g.gain;
25 .5 => e.gain;
26 .25 => e2.gain;
27 .1 => r.mix;
28
29 // set the radius (should never be more than 1)
30 dinky.radius( .999 );
31
32 // an array (our scale)
33 [ 0, 2, 4, 7, 9, 11 ] @=> int hi[];
34
35 // infinite time-loop
36 while( true )
37 {
38 // trigger
39 dinky.t( 45 + Math.random2(0,3)*12 +
40 hi[Math.random2(0,hi.size()-1)] );
41 // let time pass
42 195::ms => now;
43 // close the envelope
44 dinky.c();
45 // let a bit more time pass
46 5::ms => now;
47 }