GEN11 — Generates an additive set of cosine partials.
This subroutine generates an additive set of cosine partials, in the manner of Csound generators buzz and gbuzz.
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 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.
Note | |
---|---|
|
Here is a simple example of the GEN11 routine. It uses the file gen11.csd. It will generate a simple cosine wave. Here is its diagram:
Example 561. A simple example of the GEN11 routine.
See the sections Real-time 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 Non-realtime ouput leave only the line below: ; -o gen11.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 kamp = 30000 kcps = 440 ifn = 1 ; Play the cosine wave stored in Table #1. a1 oscil kamp, kcps, ifn out a1 endin </CsInstruments> <CsScore> ; Table #1: a simple cosine wave (using GEN11). f 1 0 16384 11 1 1 ; Play Instrument #1 for 2 seconds. i 1 0 2 e </CsScore> </CsoundSynthesizer>