20051003 at 17:01
Csound GEN Routines
Csound is the leading opensource sound/musicsynthesis software. This page is a quickreference guide for the use of the GEN routines. For indepth information, just refer to the Csound Canonical Reference Manual.
GEN01,
GEN02,
GEN03,
GEN04,
GEN05,
GEN06,
GEN07,
GEN08,
GEN09,
GEN10,
GEN11,
GEN12,
GEN13,
GEN14,
GEN15,
GEN16,
GEN17,
GEN18,
GEN19,
GEN20,
GEN21,
GEN23,
GEN24,
GEN25,
GEN27,
GEN28,
GEN30,
GEN31,
GEN32,
GEN33,
GEN34,
GEN40,
GEN41,
GEN42,
GEN51,
GEN52
GEN01
Transfers data from a soundfile into a function table. The soundfile is in one of the supported formats  wave, aiff, or au  and is directly accessable by the local host. Once loaded into memory, the soundfile can be referenced using an ftable number.

usage  
f# time size 1 filcod skiptime format channel

parameters   size  number of points in the table. Ordinarily a power of 2 or a powerof2 plus 1; the maximum tablesize is 16777216 (2^24) points. The allocation of table memory can be deferred by setting this parameter to 0; the size allocated is then the number of points in the file (probably not a powerof2), and the table is not usable by normal oscillators, but it is usable by a loscil unit. The soundfile can also be mono or stereo.
 filcod  integer or characterstring denoting the source soundfile name. An integer denotes the file soundin.filcod ; a characterstring (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the file is sought first in the current directory, then in that given by the environment variable SSDIR (if defined) then by SFDIR.
 skiptime  time duration to skip at the beginning of the soundfile. The skiptime is denominate in seconds and will or course be converted into samples.
 format  specifies the audiofileformat of soundfile. This is a single integer as follows: 1 = 8bit signed, 2 = 8bit Alaw, 3 = 8bit Ulaw, 4 = 16bit signed, 5 = 32bit integers, 6 = 32bit floating (IEEE).
 channel  channel number to read, which is a onebased index. A channel value of "0" specifies that all channels should be read.

GEN02
GEN02 interprets each of the input parameters, starting with parameter p5 as a single sample in the ftable. The number of parameters starting with p5 be less than or equal to the declared table size.

usage  
f# time size 2 v1 v2 v3 ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 v1, v2, v3, ...  samples or tablevalues that are interpreted as successive ftable values. The number of values is limited by the compiletime variable PMAX, which controls the maximum pfields (currently 1000). The values copied may include the table guard point; any table locations not filled will contain zeros.

GEN03
GEN03 creates a stored function table by evaluating a polynomial in x over a fixed interval and with specified coefficients. The fixedinterval along the "X" axis is defined by parameters p5 and p6. The interval will be evenly spread over the resulting ftable's samples. The remaining parameters are the coefficients for the nth power polynomials used for defining the function. The resulting function is c0 + c1 X + c2 X^{2} . . . + c3 X^{3}.
GEN03 is useful in conjunction with table or tablei for audio waveshaping (sound modification by nonlinear 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.

usage  
f# time size 3 xval1 xval2 c0 c1 ... cn

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 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 (powerof2 plus l)th stored value respectively in the generated function table.
 c0, c1, c2 ... cn  coefficients of the nth order polynomial.

GEN04
GEN04 analyzes the specified ftable and creates a normalizing table. A signal that's modified with a waveshaping table may also have it's amplitude altered (if the waveshaping table is so scaled, see GEN03). GEN04 creates a table of samples that when multiplied with the original waveshaping table, will produce a normalized result. The result of the waveshaping and the GEN04 scaling will produce a signal whose amplitude has been shaped not scaled.

usage  
f# time size 4 source sourcemode

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 source  table number of stored function to be examined.
 sourcemode  a coded value, specifying how the source table is to be scanned to obtain the normalizing function. Zero indicates that the source is to be scanned from left to right. Nonzero indicates that the source has a bipolar structure; scanning will begin at the midpoint and progress outwards, looking at pairs of points equidistant from the center.

GEN05
GEN05 generates an ftable function from one or more exponential function segments. Each segment is defined with three parameters:
 (a) the starting amplitude,
 (b) the width of the segment in samples, and
 (c) the ending amplitude.
For GEN05, the segment that's drawn between the starting and ending amplitudes uses an exponential function. For the next segment, the ending amplitude is used as the starting amplitude for the next segment. If a discontinuity is required, zerowidth segments can be defined.

usage  
f# time size 5 a n1 b n2 c ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 a, b, c, ...  ordinate values, in oddnumbered pfields p5, p7, p9, . . . These must be nonzero and must be alike in sign.
 n1, n2, ...  length of segment (no. of storage locations), in evennumbered pfields. Cannot be negative, but a zero is meaningful for specifying discontinuous waveforms (e.g. in the example below). The sum n1 + n2 + .... will normally equal size for fully specified functions. If the sum is smaller, the function locations not included will be set to zero; if the sum is greater, only the first size locations will be stored.

GEN06
Generates a stored function from segments of cubic polynomial functions. Segments link ordinate values in groups of 3: point of inflexion, maximum/minimum, point of inflexion. The first complete segment encompasses b, c, d and has length n2 + n3, the next encompasses d, e, f and has length n4 + n5, etc. The first segment (a, b with length n1) is partial with only one inflexion; the last segment may be partial too. Although the inflexion points b, d, f ... each figure in two segments (to the left and right), the slope of the two segments remains independent at that common point (i.e. the 1st derivative will likely be discontinuous). When a, c, e... are alternately maximum and minimum, the inflexion joins will be relatively smooth; for successive maxima or successive minima the inflexions will be comblike.

usage  
f# time size 6 a n1 b n2 c n3 d ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 a, c, e, ...  local maxima or minima of successive segments, depending on the reltion of these points to adjacent inflexions. May be iether positive or negative.
 b, d, f, ...  number of stored values between specified points. Cannot be negative, but a zero is meaningful for specifying discontinuities. The sum n1 + n2 + ... will normally equal size for fully specified functions.
 n1, n2, n3, ...  number of stored values between specified points. Cannot be negative, but a zero is meaningful for specifying discontinuities. The sum n1 + n2 + ... will normally equal size for fully specified functions.

GEN07
GEN07 generates an ftable function from one or more linear function segments. Each segment is defined with three parameters:
 (a) the starting amplitude,
 (b) the width of the segment in samples, and
 (c) the ending amplitude.
For GEN07, the segment that's drawn between the starting and ending amplitudes uses a linear function. For the next segment, the ending amplitude is used as the starting amplitude for the next segment. If a discontinuity is required, zerowidth segments can be defined.

usage  
f# time size 7 a n1 b n2 c ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 a, b, c, ...  ordinate values, in oddnumbered pfields p5, p7, p9, . . .
 n1, n2, ...  length of segment (no. of storage locations), in evennumbered pfields. Cannot be negative, but a zero is meaningful for specifying discontinuous waveforms. The sum n1 + n2 + .... will normally equal size for fully specified functions. If the sum is smaller, the function locations not included will be set to zero; if the sum is greater, only the first size locations will be stored.

GEN08
Generates a piecewise spline curve. Each segment of the generated ftable consisists of a single spline curve. Like GEN05 and GEN07, the input parameters are interpreted in groups of 3, where each group specifies the beginning level/ordinate, the segment length, and the ending level/ordinate. Moreover, the end of each group of 3 parameters is the first of the next group.

usage  
f# time size 8 a n1 b n2 c ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 a, b, c, ...  ordinate values, in oddnumbered pfields p5, p7, p9, . . .
 n1, n2, ...  length of segment (no. of storage locations), in evennumbered pfields. Cannot be negative, but a zero is meaningful for specifying discontinuous waveforms (e.g. in the example below). The sum n1 + n2 + .... will normally equal size for fully specified functions. If the sum is smaller, the function locations not included will be set to zero; if the sum is greater, only the first size locations will be stored.

GEN09
Generates a compositive waveform that's compriised of a weightedsum of simple sinusoids. The input parameters are interpreted in groups of 3: (a) the partial number, which can be an integer or a fractional value, (b) the relative amplitude or strength of the partial, and (c) partial's initial phase. In each case the composite wave, once drawn, is then rescaled to unity if p4 was positive. A negative p4 will cause rescaling to be skipped.

usage  
f# time size 9 pna stra phsa pnb strb phsb ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 pna, pnb, ...  partial no. (relative to a fundamental that would occupy size locations per cycle) of sinusoid a, sinusoid b, etc. Must be positive, but need not be a whole number, i.e., nonharmonic partials are permitted. Partials may be in any order.
 stra, strb, ...  strength of partials pna, pnb, etc. These are relative strengths, since the composite waveform may be rescaled later. Negative values are permitted and imply a 180 degree phase shift.
 phsa, phsb, ...  initial phase of partials pna, pnb, etc., expressed in degrees (0360).

GEN10
Generates a compositive waveform made up of weighted sums of simple sinusoids. Note that the primary frequency and the overtones can be generated using this GEN routine. Subharmonics cannot be generated with GEN10.

usage  
f# time size 10 str1 str2 str3 str4 ... strN

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 str1, str2, ... strN  relative strengths of the fixed harmonic partial numbers: 1, 2, 3, etc. For skipped partials, use a strN value of zero.

GEN11
GEN11 Generates an additive set of cosine partials. In essence, it's an efficient GEN routine for creating static pulse trains using an small number of arguments. GEN11 is designed to generate pulsetrains with a specified number of harmonics, the lowest specified harmonic, and an amplitude coefficient.
GEN11 produces a nontimevarying version of the CSound buzz and gbuzz generators, and is similarly useful as a complex sound source in subtractive synthesis. With lh and r present it parallels gbuzz; with both absent or equal to 1 it reduces to the simpler buzz (i.e. nh equalstrength harmonic partials beginning with the fundamental).
Sampling the stored waveform with an oscillator is more efficient than using the dynamic buzz units. However, the spectral content is invariant and care is necessary, lest the higher partials exceed the Nyquist during sampling to produce foldover.

usage  
f# time size 11 nh [lh] [r]

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 nh  number of harmonics requested. Must be positive.
 lh  lowest harmonic partial present. Can be positive, zero or negative. The set of partials can begin at any partial number and proceeds upwards; if lh is negative, all partials below zero will reflect in zero to produce positive partials without phase change (since cosine is an even function), and will add constructively to any positive partials in the set. The default value is 1.
 r  multiplier in an amplitude coefficient series. This is a power series: if the lhth partial has a strength coefficient of A the (lh + n)th partial will have a coefficient of A * rn, i.e. strength values trace an exponential curve. r may be positive, zero or negative, and is not restricted to integers. The default value is 1.

GEN12
Generates the log of a modified Bessel function of the second kind, order 0, suitable for use in amplitudemodulated FM.
This subroutine draws the natural log of a modified Bessel function of the second kind, order 0 (commonly written as I subscript 0), over the xinterval requested. The call should have rescaling inhibited.
The function is useful as an amplitude scaling factor in cyclesynchronous amplitudemodulated FM. (See Palamin and Palamin, J. Audio Eng. Soc., 36/9, Sept. 1988, pp.671684.) The algorithm is interesting because it permits the normally symmetric FM spectrum to be made asymmetric around a frequency other than the carrier, and is thereby useful for formant positioning. By using a table lookup index of I(r  1/r), where I is the FM modulation index and r is an exponential parameter affecting partial strengths, the Palamin algorithm becomes relatively efficient, requiring only oscil's, table lookups, and a single exp call.

usage  
parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 xint  specifies the xinterval, over which this function is defined. The interval starts at x == 0.

GEN13
Generates an ftable based on a polynomical whose coefficients derive from the Chebyshev polynomials of the first kind. 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 fullamplitude 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.

usage  
f# time size 13 xint xamp h0 h1 h2 ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 xint  provides the left and right values [xint, +xint] of the x interval over which the polynomial is to be drawn.
 xamp  amplitude scaling factor of the sinusoid input that is expected to produce the following spectrum.
 h0, h1, h2 ...  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.
.

GEN14
Generates 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.

usage  
f# time size 14 xint xamp h0 h1 h2 ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 xint  provides the left and right values [xint, +xint] of the x interval over which the polynomial is to be drawn.
 xamp  amplitude scaling factor of the sinusoid input that is expected to produce the following spectrum.
 h0, h1, h2 ...  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.
.

GEN15
A GEN15 fstatement creates two ftables with the identification number p1 and p1 + 1. Harmonic partials with phases between 0 and 179 are written into the first table while those with phases beteen 180 and 359 are written into the second table. Using these tables, a phasequadrature instrument generates sounds containing individual harmonics with arbitrarily specified phases.

usage  
f# time size 15 xint xamp h0 phs0 h1 phs1 h2 phs2 ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 xint  provides the left and right values [xint, +xint] of the x interval over which the polynomial is to be drawn.
 xamp  amplitude scaling factor of the sinusoid input that is expected to produce the following spectrum.
 h0, h1, h2 ...  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, phs2, ...  phase in degrees of desired harmonics h0, h1, ... when the two functions of GEN15 are used with phase quadrature.

GEN16
GEN16 creates an ftable whose function extends from a starting value to the specified ending value. If type > 0, there is a slowly rising, fast decaying (convex) curve, while if type < 0, the curve is fast rising, slowly decaying (concave). If type is 0, a straightline segment is drawn.

usage  
f# time size 16 beg dur type end

parameters   beg  the starting value.
 dur  number of segments.
 type  if 0, a straight line is produced. If nonzero, then GEN16 creates the following curve, for dur steps: beg + (end  beg) * (1  exp( i*type/(dur1) )) / (1  exp(type)).
.
 end  the ending value.

GEN17
GEN17 creates a step function for the specified xy pairs. The individual stepsegments start at the specified xvalue and are held until the next xvalue. The interleaving yvalue determines the height of the function for each defined segment.

usage  
f# time size 17 x1 a x2 b x3 c ...

parameters   x1, x2, x3, ..  xordinate values, in ascending order, 0 first.
 a, b, c, ...  yvalues at those xordinates, held until the next xordinate.

GEN18
GEN18 is used for mixing together data from preexisting ftables into a single new ftable. GEN18 enables one to select a portion of the existing wavetable and to determine at which point that table should be added to the next output table. Additionally, a scaling or relativestrength factor is used for specifying the relativestrengths of each of the existing ftables when combined into the new table.

usage  
f# time size 18 fna ampa starta finisha fnb ampb startb finishb ...

parameters   fna, fnb, ...  preexisting table number to be written into the table.
 ampa, ampb  strength of wavefoms. These are relative strengths, since the composite waveform may be rescaled later. Negative values are permitted and imply a 180 degree phase shift.
 starta, startb  where to start writing the fn into the table.
 finisha, finishb  where to stop writing the fn into the table.

GEN19
Generates a compositive waveform made up of weighted sums of simple sinusoid, which are comprised of the primary frequency and a specified number of partials. Each partial uses 4parameters fields for defining the partial's number, strength, wave, and offset. Please note that the primary or fundamental frequency must also be declared in the parameter list if it is to be included.

usage  
f# time size 19 pn1 str1 phs1 dco1 pn2 str2 phs2 dco2 ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 pn1, pn2, ...  partial no. (relative to a fundamental that would occupy size locations per cycle) of sinusoid 1, sinusoid 1, etc. Must be positive, but need not be a whole number, i.e., nonharmonic partials are permitted. Partials may be in any order.
 str1, str2, ...  strength of partials pn1, pnb2 etc. These are relative strengths, since the composite waveform may be rescaled later. Negative values are permitted and imply a 180 degree phase shift.
 phs1, phs2, ...  initial phase of partials pn1, pn2, etc., expressed in degrees.
 dco1, dco2, ...  DC offset of partials pn1, pn2, etc. This is applied after strength scaling, i.e. a value of 2 will lift a 2strength sinusoid from range [2,2] to range [0,4] .

GEN20
GEN20 generates functions of different windows. These windows are usually used for spectrum analysis or for grain envelopes.

usage  
f# time size 20 window max [opt]

parameters  
GEN21
GEN21 generates ftables based on random distributions. There are multiple distribution types to choose from. The distribution is specified by the first parameter to GEN21. Note that GEN21 is not selfnormalizing as are most other GEN functions.

usage  
f# time size 21 type level [arg1 [arg2]]

parameters  
GEN23
GEN23 creates an ftable based on the contents of an ASCIIformatted file of numbers. Successive ftable values/levels are assigned to successive numeric values from the specified external file.

usage  
f# time size 23 "filename.txt"

parameters   size  number of points in the table. Must be a power of 2 , power of 2 + 1, or zero. If size = 0, table size is determined by the number of numeric values in filename.txt.
 filename.txt  numeric values contained in "filename.txt" (which indicates the complete pathname of the character file to be read), can be separated by spaces, tabs, newline characters or commas. Also, words that contains nonnumeric characters can be used as comments since they are ignored.

GEN24
GEN24 creates a new ftable whose values are the scaled samples from an existing ftable. This GEN routine reads numeric values from another allocated functiontable and rescales them according to the max and min values given by the user. This GEN is useful, for example, to eliminate the starting offset in exponential segments allowing a real starting from zero.

usage  
f# time size 24 ftable min max

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 ftable  the source ftable, which must be an already allocated table with the same size as this function.
 min, max  the rescaling range. The resulting ftable's minimum and maximum values will lie between these parameters.

GEN25
GEN25 creates an ftable from segments of exponential curves in breakpoint fashion. It is similar to GEN05 in that it produces segments of exponential curves, but instead of representing the lengths of segments and their endpoints, its arguments represent (x, y) coordinates in the table, and the subroutine produces curves between successive locations. The xcoordinates must be in increasing order.

usage  
f# time size 25 x1 y1 x2 y2 x3 ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 x1, x2, x3, ...  locations in table at which to attain the following y value. Must be in increasing order. If the last value is less than size, then the rest will be set to zero. Should not be negative but can be ze.
 y1, y2, y3, ...  Breakpoint values attained at the location specified by the preceding x value. These must be nonzero and must be alike in sign.

GEN27
GEN27 creates an ftable from segments of linear segments in breakpoint fashion. It is similar to GEN07 in that it produces segments of exponential curves, but instead of representing the lengths of segments and their endpoints, its arguments represent (x, y) coordinates in the table, and the subroutine produces segments between successive locations. The xcoordinates must be in increasing order.

usage  
f# time size 27 x1 y1 x2 y2 x3 ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 x1, x2, x3, ...  locations in table at which to attain the following y value. Must be in increasing order. If the last value is less than size, then the rest will be set to zero. Should not be negative but can be ze.
 y1, y2, y3, ...  Breakpoint values attained at the location specified by the preceding x value. These must be nonzero and must be alike in sign.

GEN28
This function generator reads a text file which contains sets of three values representing the xy coordinates and a timetag for when the signal should be placed at that location, allowing the user to define a timetagged trajectory. The file format is in the form:
 time1 X1 Y1
 time2 X2 Y2
 time3 X3 Y3
The configuration of the xy coordinates in space places the signal in the following way:
 a1 is 1, 1
 a2 is 1, 1
 a3 is 1, 1
 a4 is 1, 1
This assumes a loudspeaker set up as a1 is left front, a2 is right front, a3 is left back, a4 is right back. Values greater than 1 will result in sounds being attenuated as if in the distance. GEN28 creates values to 10 milliseconds of resolution.

usage  
parameters   size  number of points in the table. Must be 0. GEN28 takes 0 as the size and automatically allocates memory.
 filecod  characterstring denoting the source soundfile name. A characterstring (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the named file is sought in the current directory.

GEN30
Extracts a range of harmonic partials from an existing waveform to generate a new ftable. GEN30 does not support tables with an extended guard point (ie. table size = power of two + 1). Although such tables will work both for input and output, when reading source table(s), the guard point is ignored, and when writing the output table, guard point is simply copied from the first sample (table index = 0). The reason of this limitation is that GEN30 uses FFT, which requires power of two table size. GEN32 allows using linear interpolation for resampling and phase shifting, which makes it possible to use any table size (however, for partials calculated with FFT, the power of two limitation still exists).

usage  
f# time size 30 src minh maxh [ref_sr] [interp]

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 src  the source ftable number.
 minh, maxh  the minimum and maximum harmonic numbers or partials.
 ref_sr  maxh is scaled by (sr / ref_sr). The default value of ref_sr is sr. If ref_sr is zero or negative, it is now ignored.
 interp  if nonzero, allows changing the amplitude of the lowest and highest harmonic partial depending on the fractional part of minh and maxh. For example, if maxh is 11.3 then the 12th harmonic partial is added with 0.3 amplitude. This parameter is zero by default.

GEN31
Creates a new ftable by adding partials of the specified source ftable. This GEN routine is similar to a sinewavewithpartialscreator, but it produces the ftable with partials/harmonics of the source ftable rather than with a sine wave.

usage  
f# time size 31 src pna stra phsa pnb strb phsb ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 src  the source ftable number.
 pna, pnb, ...  the partial numbers relative to the base or primary frequency.
 stra, strb, ...  the relative strengths or amplitudes of the partials.
 phsa, phsb, ...  the starting phase of the partials.

GEN32
Creates a new ftable by adding partials of the specified source ftables. This GEN routine extends GEN31 by allowing each partial of the destination ftable to be created from a different input or source ftable.

usage  
f# time size 32 srca pna stra phsa srcb pnb strb phsb ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 srca, srcb, ...  source table number. A negative value can be used to read the table with linear interpolation (by default, the source waveform is transposed and phase shifted using FFT); this is less accurate, but faster, and allows noninteger and negative partial numbers.
 pna, pnb, ...  the partial numbers relative to the base or primary frequency.
 stra, strb, ...  the relative strengths or amplitudes of the partials.
 phsa, phsb, ...  the starting phase of the partials.

GEN33
GEN33 creates composite waveforms by mixing simple sinusoids, similarly to GEN09, but the parameters of the partials are specified in an already existing table, which makes it possible to calculate any number of partials in the orchestra.
The difference between GEN33 and GEN34 is that GEN33 uses inverse FFT to generate output, while GEN34 is based on the algorithm used in oscils opcode. GEN33 allows integer partials only, and does not support power of two plus 1 table size, but may be significantly faster with a large number of partials. On the other hand, with GEN34, it is possible to use noninteger partial numbers and extended guard point, and this routine may be faster if there is only a small number of partials (note that GEN34 is also several times faster than GEN09, although the latter may be more accurate).

usage  
f# time size 33 src nh scl [fmode]

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 src  source table number. This table contains the parameters of each partial in the following format: stra, pna, phsa, strb, pnb, phsb, ... the parameters are:
 stra, strb, etc.: relative strength of partials. The actual amplitude depends on the value of scl, or normalization (if enabled).

pna, pnb, etc.: partial number, or frequency, depending on fmode (see below); zero and negative values are allowed, however, if the absolute value of the partial number exceeds (size / 2), the partial will not be rendered. With GEN33, partial number is rounded to the nearest integer.

phsa, phsb, etc.: initial phase, in the range 0 to 1.
Table length (not including the guard point) should be at least 3 * nh. If the table is too short, the number of partials (nh) is reduced to (table length) / 3, rounded towards zero.
 nh  number of partials. Zero or negative values are allowed, and result in an empty table (silence). The actual number may be reduced if the source table (src) is too short, or some partials have too high frequency.
 scl  amplitude or scaling factor.
 fmode  (default == 0) a nonzero value can be used to set frequency in Hz instead of partial numbers in the source table. The sample rate is assumed to be fmode if it is positive, or (sr * fmode) if any negative value is specified.

GEN34
GEN33 creates composite waveforms by mixing simple sinusoids, similarly to GEN09, but the parameters of the partials are specified in an already existing table, which makes it possible to calculate any number of partials in the orchestra.
The difference between GEN33 and GEN34 is that GEN33 uses inverse FFT to generate output, while GEN34 is based on the algorithm used in oscils opcode. GEN33 allows integer partials only, and does not support power of two plus 1 table size, but may be significantly faster with a large number of partials. On the other hand, with GEN34, it is possible to use noninteger partial numbers and extended guard point, and this routine may be faster if there is only a small number of partials (note that GEN34 is also several times faster than GEN09, although the latter may be more accurate).

usage  
f# time size 34 src nh scl [fmode]

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 src  source table number. This table contains the parameters of each partial in the following format: stra, pna, phsa, strb, pnb, phsb, ... the parameters are:
 stra, strb, etc.: relative strength of partials. The actual amplitude depends on the value of scl, or normalization (if enabled).

pna, pnb, etc.: partial number, or frequency, depending on fmode (see below); zero and negative values are allowed, however, if the absolute value of the partial number exceeds (size / 2), the partial will not be rendered. With GEN33, partial number is rounded to the nearest integer.

phsa, phsb, etc.: initial phase, in the range 0 to 1.
Table length (not including the guard point) should be at least 3 * nh. If the table is too short, the number of partials (nh) is reduced to (table length) / 3, rounded towards zero.
 nh  number of partials. Zero or negative values are allowed, and result in an empty table (silence). The actual number may be reduced if the source table (src) is too short, or some partials have too high frequency.
 scl  amplitude or scaling factor.
 fmode  (default == 0) a nonzero value can be used to set frequency in Hz instead of partial numbers in the source table. The sample rate is assumed to be fmode if it is positive, or (sr * fmode) if any negative value is specified.

GEN40
Generates a continuous random distribution function starting from the shape of a userdefined distribution histogram. Histogram shape can be generated with any other GEN routines. Since no interpolation is used when GEN40 processes the translation, it is suggested that the size of the table containing the histogram shape to be reasonably big, in order to obtain more precision (however after the processing the shapingtable can be destroyed in order to regain memory).

usage  
parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 shapetab  the identifier of the ftable that contains the distributionshape or histogram data.

GEN41
Generates a discrete random distribution function by giving a list of numerical pairs. The first number of each pair is a value, and the second is the probability of that value to be chosen by a random algorithm. Even if any number can be assigned to the probability element of each pair, it is suggested to give it a percent value, in order to make it clearer for the user.

usage  
f# time size 41 value1 prob1 value2 prob2 ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 value1, value2, ...  the values to be created on a random basis.
 prob1, prob2, ...  the relative probability coefficient for each of the values.

GEN42
Generates a random distribution function of discrete ranges of values by giving a list of groups of three numbers. The first number of each group is a the minimum value of the first range, the second is the maximum value and the third is the probability of that an element belonging to that range of values can be chosen by a random algorithm. Even if any number can be assigned to the probability element of each group, it is suggested to give it a percent value, in order to make it clearer to the user.

usage  
f# time size 41 min1 max1 prob1 min2 max2 prob2 ...

parameters   size  number of points in the table. This value must be a powerof2 or a powerof2 plus 1.
 min1, min2, ...  the minimum or floor for range n.
 max1, max2, ...  the maximum or ceiling for range n.
 prob1, prob2, ...  the relative probability coefficient for each of the ranges.

GEN51
GEN51 fills a table with a fully customized microtonal tuning in the manner of Csound opcodes cpstun, cpstuni, and cpstmid.

usage  
f# time size 51 numgrades interval basefreq basekey tuningRatio1 tuningRatio2 ...

parameters   size  number of points in the table.
 numgrades  the number of grades/pitches in the microtonal tuning.
 interval  the frequency range covered before repeating the grade ratios (i.e., the equivalence interval or the identity interval). This is real number. For octave equivalence, use 2.0. For BohlenPierce tuning use 3.0.
 basefreq  the tuning's base frequency in Hz.
 basekey  the integer index of the scale, to which to assign basefreq unmodified.
 tuningRatio1, tuningRatio2, ...  the pitches or ratios in the tuning/scale. The number of tuningratio arguments must match the numgrades parameter.

GEN52
GEN52 creates an interleaved multichannel table from the specified source tables in the format expected by the ftconv opcode. It can also be used to extract a channel from a multichannel table and store it in a normal mono table, copy tables with skipping some samples, adding delay, or store in reverse order.

usage  
f# time size 52 nchannels channel_params_1 channel_params_2 ...

parameters   size  number of points in the table.
 nchannels  the number of channel parameters passed.
 channel_params_1, channel_params_2, ...  the channel parameters required for use of the ftconv opcode.
