| 1 |
// gen9 inharmonic sinusoidal lookup table |
| 2 |
// ported to ChucK from rtcmix by dan trueman |
| 3 |
// see luke's page: http://www.music.columbia.edu/cmix/makegens.html |
| 4 |
|
| 5 |
// patch |
| 6 |
Phasor drive => Gen9 g9 => dac; |
| 7 |
|
| 8 |
// can also lookup table values directly: |
| 9 |
// g9.lookup(index); |
| 10 |
// with index:[0,1] |
| 11 |
|
| 12 |
// load up the coeffs |
| 13 |
// these are in triplets: |
| 14 |
// harmonic partial ratio, amplitude, phase |
| 15 |
// see the RTcmix page: |
| 16 |
// http://www.music.columbia.edu/cmc/Rtcmix/docs/scorefile/gen9.html |
| 17 |
// for nice documentation of this gen |
| 18 |
[1., 1., 0., 2, 0.5, 90., 3., 0.2, 180.] => g9.coefs; |
| 19 |
// [1., 1., 0.] => g9.coefs; // a simple one |
| 20 |
|
| 21 |
// make it quiet |
| 22 |
0.1 => g9.gain; |
| 23 |
|
| 24 |
// set frequency for reading through table |
| 25 |
drive.freq( 440. ); |
| 26 |
|
| 27 |
// create an envelope to scan through the table values |
| 28 |
// so we can look at them as well as hear them |
| 29 |
Envelope e => blackhole; |
| 30 |
e.duration(10000::ms); |
| 31 |
0. => e.value; |
| 32 |
e.keyOn(); |
| 33 |
|
| 34 |
// yay |
| 35 |
while (true) |
| 36 |
{ |
| 37 |
// print |
| 38 |
<<< e.value(), g9.lookup(e.value()) >>>; |
| 39 |
|
| 40 |
// end |
| 41 |
if( e.value() == 1. ) break; |
| 42 |
|
| 43 |
// advance time |
| 44 |
10::ms => now; |
| 45 |
} |