| 1 |
// gen7: 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#03 |
| 5 |
|
| 6 |
// make one, no sound |
| 7 |
Gen7 g7; |
| 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 linear segments |
| 13 |
|
| 14 |
// set coefficients |
| 15 |
[0., 0.5, 1., 0.5, 0.] => g7.coefs; |
| 16 |
|
| 17 |
// create an envelope to scan through the table values |
| 18 |
Envelope e => blackhole; |
| 19 |
e.duration(10000::ms); |
| 20 |
0. => e.value; |
| 21 |
e.keyOn(); |
| 22 |
|
| 23 |
// loop |
| 24 |
while (true) |
| 25 |
{ |
| 26 |
// print |
| 27 |
<<< e.value(), g7.lookup(e.value()) >>>; |
| 28 |
|
| 29 |
// end |
| 30 |
if(e.value() == 1.) break; |
| 31 |
|
| 32 |
// advance time |
| 33 |
10::ms => now; |
| 34 |
} |