Creates two tables of stored polynomial functions, suitable for use in phase quadrature operations.
Syntax
f#timesize15xintxamph0phs0h1phs1h2phs2...
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. This subroutine will eventually call GEN03 to draw both functions; this p5 value 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.
phs0, phs1, ... -- phase in degrees of desired harmonics h0, h1, ... when the two functions of GEN15 are used with phase quadrature.
Notes
GEN15 creates two tables of equal size, labeled f# and f # + 1. Table # will contain a Chebyshev function of the first kind, drawn using GEN13 with partial strengths h0cos(phs0), h1cos(phs1), ... Table #+1 will contain a Chebyshev function of the 2nd kind by calling GEN14 with partials h1sin(phs1), h2sin(phs2),... (note the harmonic displacement). The two tables can be used in conjunction in a waveshaping network that exploits phase quadrature.
Before version 5.16 there was a bug (pointed out by Menno Knevel and fixed by François Pinot) on the number of pfields transmitted to gen13 and gen14 by gen15. The consequence is that all the csd, or orc and sco files that used gen15 before this bug was fixed, are likely to sound different now.
Examples
Here is an example of the GEN15 routine. It uses the files gen15.csd.
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform-odac ;;;realtime audio out;-iadc ;;;uncomment -iadc if realtime audio input is needed too; For Non-realtime ouput leave only the line below:; -o gen15.wav -W ;;; for file output any platform</CsOptions><CsInstruments>;example from the Csound Book, page 85sr=44100ksmps=32nchnls=20dbfs=1instr1idur=p3iamp=p4ifrq=cpspch(p5);pitchiswp1=p6iswp2=p7kswplineiswp1,p3,iswp2;amplitude sweep valuesacosioscilikswp*.5,ifrq,2;f2=cosine waveasineoscilikswp,ifrq,1;f1=sine waveatab1tableiacosi,33,1,.5;tables a1 to GEN13atab2tableiacosi,34,1,.5;tables a1 to GEN14knrm1tableikswp,35,1;normalizing f35knrm2tableikswp,36,1;normalizing f36anrm1=atab1*knrm1;normalize GEN13 signalanrm2=atab2*knrm2*asine;normalize GEN14 signalamix=anrm1+anrm2;mix GEN13 and GEN14kenvexpseg.001,idur*.1,iamp,idur*.1,iamp*.8,idur*.8,.001asig=amix*kenvoutsasig,asigendin</CsInstruments><CsScore>f108193101;sine wavef20819391190;cosine wave; Note that all the f33 tables in the following sections are defined with p4=-15,; which means that tables 33 and 34 will not be normalized. Thus if we display; tables when running this example, we'll get correct diagrams even if one table; has very small values instead of 0 values, due to cpu approximations in processing; sin(180), as in sections 2, 4, and 5. This has no consequence on the audio result,; because of the use of amp normalization (tables 35 and 36).f3308193-1511101180.845.6270.590.4225.2135.1315;makes function tables 33 and 34f35040974331;amp normalization for f33f36040974341;amp normalization for f34i105.68.0001i1+..68.0010s;even harmonics with no phase shift, odd harmonics with phase shiftf3308193-1511101011801180101011801180101011801180f35040974331;amp normalization for f33f36040974341;amp normalization for f34i105.68.0001i1+..68.0010s;different harmonic strenghts and phasesf3308193-15111010.9180.5270.7590.445.2225.10f35040974331;amp normalization for f33f36040974341;amp normalization for f34i105.68.0001i1+..68.0010s;lower harmonics no phase shift, upper harmonics with phase shiftf3308193-15111010.50.90.30.750.2180.6180.15180.5180.1180f35040974331;amp normalization for f33f36040974341;amp normalization for f34i105.68.0001i1+..68.0010s;lower harmonics with phase shift, upper harmonics no phase shiftf3308193-151111801180.5180.9180.3180.75180.20.60.150.50.10f35040974331;amp normalization for f33f36040974341;amp normalization for f34i105.68.0001i1+..68.0010e</CsScore></CsoundSynthesizer>
These are the diagrams of the waveforms of the GEN15 routine, as used in the example
(in each diagram, the curve in blue is for ftable 33 and the curve in green is for
table 34):