**GEN** Routines: Sine/Cosine Generators

## GEN11

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

### Description

This subroutine generates an additive set of cosine partials, in the manner of Csound generators **buzz** and **gbuzz**.

### Initialization

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

*nh * – number of harmonics requested. Must be positive.

*lh *(optional) – 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 *(optional) – multiplier in an amplitude coefficient series. This is a power series: if the *lh*th partial has a strength coefficient of A the (*lh* + n)th partial will have a coefficient of A * r^{n}, 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.

### Note

This subroutine is a non-time-varying 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* equal-strength harmonic partials beginning with the fundamental).

Sampling the stored waveform with an oscillator is more efficient than using 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.

### Examples

**f** 1 0 2049 11 4
**f** 2 0 2049 11 4 1 1
**f** 3 0 2049 -11 7 3 .5

The first two tables will contain identical band-limited pulse waves of four equal-strength harmonic partials beginning with the fundamental. The third table will sum seven consecutive harmonics, beginning with the third, and at progressively weaker strengths (1, .5, .25, .125 . . .). It will not be post-normalized.

**GEN** Routines: Sine/Cosine Generators