**GEN** Routines: Sine/Cosine Generators

## GEN09, GEN10, GEN19

**f** # time size 9 pna stra phsa pnb strb phsb . . .
**f** # time size 10 str1 str2 str3 str4 . . . .
**f** # time size 19 pna stra phsa dcoa pnb strb phsb dcob . . .

### Description

These subroutines generate composite waveforms made up of weighted sums of simple sinusoids. The specification of each contributing partial requires 3 pfields using **GEN09**, 1 using **GEN10**, and 4 using **GEN19**.

### Initialization

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

*pna, pnb*, etc. – 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., non-harmonic partials are permitted. Partials may be in any order.

*stra, strb*, etc. – 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*, etc. – initial phase of partials *pna, pnb,* etc., expressed in degrees.

*dcoa, dcob*, etc. – DC offset of partials *pna, pnb*, etc. This is applied *after* strength scaling, i.e. a value of 2 will lift a 2-strength sinusoid from range [-2,2] to range [0,4] (before later rescaling).

*str1, str2, str3,* etc. – relative strengths of the fixed harmonic partial numbers 1,2,3, etc., beginning in p5. Partials not required should be given a strength of zero.

### Note

These subroutines generate stored functions as sums of sinusoids of different frequencies. The two major restrictions on **GEN10** that the partials be harmonic and in phase do not apply to **GEN09** or **GEN19**.

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.

### Examples

**f** 1 0 1024 9 1 3 0 3 1 0 9 .3333 180
**f** 2 0 1024 19 .5 1 270 1

f1 combines partials l, 3 and 9 in the relative strengths in which they are found in a square wave, except that partial 9 is upside down. f 2 creates a rising sigmoid [0 - 2]. Both will be rescaled.

**GEN** Routines: Sine/Cosine Generators