GEN03GEN03GEN03
Generates a stored function table by evaluating a polynomial.
Description
This subroutine generates a stored function table by evaluating a polynomial in x over a fixed interval and with specified coefficients.
Syntaxf # time size 3 xval1 xval2 c0 c1 c2 ... cnInitializationsize -- number of points in the table. Must be a power of 2 or a power-of-2 plus 1.
xval1, xval2 -- left and right values of the x interval over which the polynomial is defined (xval1 < xval2). These will produce the 1st stored value and the (power-of-2 plus l)th stored value respectively in the generated function table.
c0, c1, c2, ..., cn -- coefficients of the nth-order polynomial
C0 + C1x +
C2x2 + . . . +
Cnxn
Coefficients may be positive or negative real numbers; a zero denotes a missing term in the polynomial. The coefficient list begins in p7, providing a current upper limit of 144 terms.
Note
The defined segment [fn(xval1), fn(xval2)] is evenly distributed. Thus a 512-point table over the interval [-1,1] will have its origin at location 257 (at the start of the 2nd half). Provided the extended guard point is requested, both fn(-1) and fn(1) will exist in the table.
GEN03 is useful in conjunction with table or tablei for audio waveshaping (sound modification by non-linear distortion). Coefficients to produce a particular formant from a sinusoidal lookup index of known amplitude can be determined at preprocessing time using algorithms such as Chebyshev formulae. See also GEN13.
Examples
Here is an example of the GEN03 generator. It uses the file gen03.csd.
Example of the GEN03 generator.See the sections Real-time Audio and Command Line Flags for more information on using command line flags.These are the diagrams of the waveforms of the GEN03 routines, as used in the example:f4 0 513 3 1 1 0 1 - first-order Chebyshev: x