GEN31 — Mixes any waveform specified in an existing table.


This routine is similar to GEN09, but allows mixing any waveform specified in an existing table.


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


src -- source table number

pna, pnb, ... -- partial number, must be a positive integer

stra, strb, ... -- amplitude scale

phsa, phsb, ... -- start phase (0 to 1)

GEN31 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 GEN31 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).


Here is an example of the GEN31 routine. It uses the files gen31.csd.

Example 1328. Example of the GEN31 routine.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.


0dbfs = 1

gisine  ftgen  0,0,4096,10,1
gi31    ftgen  0,0,4096,31,gisine, 1,1,0, 2,1,0, 3,1,0, 4,1,0, 5,1,0, 6,1,0

instr 1
  aa  oscil3  0.6, 440, gi31
      out     aa

i1 0 5



Author: Istvan Varga

New in version 4.15