*** empty log message ***
[chuck-blob.git] / v2 / examples / class / try.ck
blob7ab374a73a42f790df632959ee345cfd2f8110d3
1 // uses the Dinky class
2 // (run dinky.ck before running this, for now...)
3 //
4 //     > chuck dinky try
5 //
6 // NOTE: 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
11 // instantiate a Dinky (not connected yet)
12 Dinky imp;
14 // connect the rest of the patch
15 Gain g => NRev r => Echo e => Echo e2 => dac;
16 // direct/dry
17 g => dac;
18 e => dac;
20 // set up delay, gain, and mix
21 1500::ms => e.max => e.delay;
22 3000::ms => e2.max => e2.delay;
23 1 => g.gain;
24 .5 => e.gain;
25 .25 => e2.gain;
26 .1 => r.mix;
28 // connect the Dinky
29 // (in a future version of chuck, Dinky can be defined as an UGen)
30 imp.connect( g );
31 // set the radius (should never be more than 1)
32 imp.radius( .999 );
34 // an array (our scale)
35 [ 0, 2, 4, 7, 9, 11 ] @=> int hi[];
37 // infinite time-loop
38 while( true )
40     // trigger
41     45 + Std.rand2(0,3) * 12 + 
42          hi[Std.rand2(0,hi.cap()-1)] => imp.t;
43     // let time pass
44     195::ms => now;
45     // close the envelope
46     imp.c();
47     // let a bit more time pass
48     5::ms => now;