**QUICK-REF** - **CsoundManual**
- **Top of this section** - Previous
- Contents - Index
- Next

## GEN13, GEN14

` `**f** # time size 13 xint xamp h0 h1 h2 . . . hn
**f** # time size 14 xint xamp h0 h1 h2 . . . hn

__DESCRIPTION__

These subroutines use Chebyshev coefficients to generate stored polynomial
functions which, under waveshaping, can be used to split a sinusoid into
harmonic partials having a predefinable spectrum.

__INITIALIZATION__

*size* - number of points in the table. Must be a power of 2 or
a power-of-2 plus 1 ( see f statement).
The normal value is power-of-2 plus 1.

*xint* - provides the left and right values [*-xint, +xint*]
of the x interval over which the polynomial is to be drawn. These subroutines
both call **GEN03** to draw their functions; the
p5 value here is therefor expanded to a negative-positive p5,p6 pair before
**GEN03** is actually called. The normal value
is 1.

*xamp *- amplitude scaling factor of the sinusoid input that is
expected to produce the following spectrum.

*h0, h1, h2, .... hn* - relative strength of partials 0 (DC), 1
(fundamental), 2 ... that will result when a sinusoid of amplitude *xamp
* int(size/2)/xint* is waveshaped using this function table. These values
thus describe a frequency spectrum associated with a particular factor
*xamp* of the input signal.

Note:

**GEN13** is the function generator normally employed in standard
waveshaping. It stores a polynomial whose coefficients derive from the
Chebyshev polynomials of the first kind, so that a driving sinusoid of
strength *xamp* will exhibit the specified spectrum at output. Note
that the evolution of this spectrum is generally not linear with varying
*xamp*. However, it is bandlimited (the only partials to appear will
be those specified at generation time); and the partials will tend to occur
and to develop in ascending order (the lower partials dominating at low
*xamp*, and the spectral richness increasing for higher values of
*xamp*). A negative *hn* value implies a 180 degree phase shift
of that partial; the requested full-amplitude spectrum will not be affected
by this shift, although the evolution of several of its component partials
may be. The pattern +,+,-,-,+,+,... for *h0,h1,h2..*. will minimize
the normalization problem for low *xamp* values (see above), but does
not necessarily provide the smoothest pattern of evolution.

**GEN14** stores a polynomial whose coefficients derive from Chebyshevs
of the second kind.

__EXAMPLE:__

` f 1 0 1025 13 1 1 0 5 0 3 0 1 `

This creates a function which, under waveshaping, will split a sinusoid
into 3 odd-harmonic partials of relative strength 5:3:1.

**QUICK-REF** - **CsoundManual**
- **Top of this section** - Previous
- Contents - Index
- Next

*HTML Csound Manual - ©
Jean Piché & Peter J. Nix, 1994-97*