Debian Codegraph @

examples/special/readme-GenX.ck

raw
1 //-----------------------------------------------------------------------------
2 // name: readme-GenX.ck
3 // desc: old and new lookup table utilities for ChucK
4 //
5 // author: Dan Trueman, 2007
6 //
7 // These utilities bring the familiar lookup table capabilities of the MusicX
8 // languages to ChucK. They all create an internal lookup table given various
9 // parameters set by the user. This table can then be read at the audio rate
10 // (with Phasor, for example, or any other source) or simply read with .value()
11 // calls.
12 //
13 // A simple example for gen10 is included here. gen10 creates a table of
14 // harmonically related sinusoids; the user sets the relative weights of the
15 // harmonics with an array of floats. The phasor UG creates a continuous
16 // lookup value between 0 and 1 (values less than 0 are multiplied by -1, so
17 // SinOsc and other [-1,1] sources can be used as well).
18 //
19 // All of these other than WarpTable were ported from RTcmix (thanks rtcmix folks!).
20 //-----------------------------------------------------------------------------
21
22 // patch
23 Phasor drive => Gen10 g10 => dac;
24 // can also lookup table values directly:
25 // g10.lookup(index);
26 // with index:[0,1]
27
28 // load up the coeffs; amplitudes for successive partials
29 g10.coefs( [1., 0.5, 0.3, 0.2] );
30
31 // set frequency for reading through table
32 drive.freq( 440. );
33
34 // go
35 while( true ) { 1::day => now; }
36
37 //-----------------------------------------------------------------------------
38
39 /*
40 the GenX library includes:
41
42 gen5: exponential line segment table generator (probably superceded by CurveTable)
43 gen7: line segment table generator (probably superceded by CurveTable)
44 gen9: inharmonic sinusoidal lookup table with ratio and phase control
45 gen10: sinusoidal lookup table *without* ratio and phase control (only partial amp control)
46 gen17: chebyshev polynomial lookup table
47 CurveTable: flexible Curve/Line segment table generator
48 WarpTable: end-constrained mapping table, useful for control signal conditioning
49 */