File: try.ck

package info (click to toggle)
chuck 1.5.5.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 41,056 kB
  • sloc: cpp: 123,473; ansic: 35,893; javascript: 2,111; yacc: 609; makefile: 457; python: 174; perl: 86
file content (47 lines) | stat: -rw-r--r-- 1,205 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// uses the Dinky class
// (run dinky.ck before running this, for now...)
//
//     > chuck dinky try
//
// NOTE (2003): in a future version of chuck...
//       1. we will have better dependency/include system
//       2. we can extend Dinky from UGen, so we don't have 
//          to use a 'connect( UGen )' function in Dinky
// NOTE (2013): the above (#2) is now possible using Chugraphs!
//       check out: extend/chugraph.ck
// NOTE (2023): actually updated dinky.ck and this example
//       to use Chugraphs

// connect the rest of the patch
Dinky dinky => Gain g => NRev r => Echo e => Echo e2 => dac;
// direct/dry
g => dac;
e => dac;

// set up delay, gain, and mix
1500::ms => e.max => e.delay;
3000::ms => e2.max => e2.delay;
1 => g.gain;
.5 => e.gain;
.25 => e2.gain;
.1 => r.mix;

// set the radius (should never be more than 1)
dinky.radius( .999 );

// an array (our scale)
[ 0, 2, 4, 7, 9, 11 ] @=> int hi[];

// infinite time-loop
while( true )
{
    // trigger
    dinky.t( 45 + Math.random2(0,3)*12 +
             hi[Math.random2(0,hi.size()-1)] );
    // let time pass
    195::ms => now;
    // close the envelope
    dinky.c();
    // let a bit more time pass
    5::ms => now;
}