Debian Codegraph @

examples/special/Gen5-test.ck

raw
1 // gen5: exponential line segment table generator
2 // probably superceded by CurveTable
3 // ported to ChucK from rtcmix by dan trueman
4 // see luke's page: http://www.music.columbia.edu/cmix/makegens.html#02
5
6 // make one, no sound here
7 Gen5 g5;
8
9 // set up the values [0,1] and distances in the table
10 // first arg is initial value
11 // followed by pairs indicating distance (total distance = 1)
12 // and destination value for exponential segments
13 // NOTE: real minimum value is 0.000001
14
15 // the following will create a triangle, with a peak at 1 halfway
16 // through the table
17 [0., 0.5, 1., 0.5, 0.] => g5.coefs;
18
19 // create an envelope to scan through the table values
20 // creates a continuous input from 0 -> 1 over 10 seconds
21 Envelope e => blackhole;
22 e.duration( 10000::ms );
23 0. => e.value;
24 e.keyOn();
25
26 // loop
27 while (true)
28 {
29 // print
30 <<<e.value(), g5.lookup(e.value())>>>;
31
32 // end
33 if( e.value() == 1. ) break;
34
35 // advance time
36 10::ms => now;
37 }