GEN14 — Stores a polynomial whose coefficients derive from Chebyshevs of the second kind.
Uses Chebyshev coefficients to generate stored polynomial functions which, under waveshaping, can be used to split a sinusoid into harmonic partials having a predefinable spectrum.
size  number of points in the table. Must be a power of 2 or a powerof2 plus 1 (see f statement). The normal value is powerof2 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 therefore expanded to a negativepositive 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, etc.  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  


Here is a simple example of the GEN14 routine. It uses the file gen14.csd. It creates a function which, under waveshaping, will split a sinusoid into 3 oddharmonic partials of relative strength 5:3:1. Here is its diagram:
Example 564. A simple example of the GEN14 routine.
See the sections Realtime Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform ; Audio out Audio in odac iadc ;;;RT audio I/O ; For Nonrealtime ouput leave only the line below: ; o gen14.wav W ;;; for file output any platform </CsOptions> <CsInstruments> ; Initialize the global variables. sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ; Instrument #1. instr 1 ; Create an index over the length of our entire note. kcps init 1/p3 kndx phasor kcps ; Read Table #1 with our index. ifn = 1 ixmode = 1 kval table kndx, ifn, ixmode ; Generate a sine waveform, use our Table #1 value to ; vary its frequency by 100 Hz from its base frequency. ibasefreq = 440 kfreq = kval * 100 a1 oscil 20000, ibasefreq + kfreq, 2 out a1 endin </CsInstruments> <CsScore> ; Table #1: a polynomial function (using GEN14). f 1 0 1025 14 1 1 0 5 0 3 0 1 ; Table #2, a sine wave. f 2 0 16384 10 1 ; Play Instrument #1 for 2 seconds. i 1 0 2 e </CsScore> </CsoundSynthesizer>