gir -- either a requested or automatically assigned table number above 100.
ifn -- requested table number If ifn is zero, the number is assigned automatically and the value placed in gir. Any other value is used as the table number
itime -- is ignored, but otherwise corresponds to p2 in the score f statement.
isize -- table size. Corresponds to p3 of the score f statement.
igen -- function table GEN routine. Corresponds to p4 of the score f statement.
iarga, iargb, ... -- function table arguments. Correspond to p5 through pn of the score f statement.
This is equivalent to table generation in the score with the f statement.
![]() |
Warning |
---|---|
Although Csound will not protest if ftgen is used inside instr-endin statements, this is not the intended or supported use, and must be handled with care as it has global effects. (In particular, a different size usually leads to relocation of the table, which may cause a crash or otherwise erratic behaviour. |
Here is an example of the ftgen opcode. It uses the files ftgen.orc and ftgen.sco.
Example 164. Example of the ftgen opcode.
/* ftgen.orc */ ; Initialize the global variables. sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ; Table #1, a sine wave using the GEN10 routine. gitemp ftgen 1, 0, 16384, 10, 1 ; Instrument #1 - a basic oscillator. instr 1 kamp = 10000 kcps = 440 ; Use Table #1. ifn = 1 a1 oscil kamp, kcps, ifn out a1 endin /* ftgen.orc */
/* ftgen.sco */ ; Play Instrument #1 for 2 seconds. i 1 0 2 e /* ftgen.sco */