f Statement (or Function Table Statement) — Causes a GEN subroutine to place values in a stored function table.

This causes a GEN subroutine to place values in a stored function table for use by instruments.

*p1* -- Table number by which the stored function will be known. A negative number requests that the table be destroyed.

*p2* -- Action time of function generation (or destruction) in beats.

*p3* -- Size of function table (i.e. number of points) Must be a power of 2, or a power-of-2 plus 1 (see below). Maximum table size is 16777216 (2**24) points.

*p4* -- Number of the GEN routine to be called (see *GEN ROUTINES*). A negative value will cause rescaling to be omitted.

*p5*

*p6 ...* -- Parameters whose meaning is determined by the particular GEN routine.

Function tables are arrays of floating-point values. Arrays can be of any length in powers of 2; space allocation always provides for 2^{n} points plus an additional *guard point*. The guard point value, used during interpolated lookup, can be automatically set to reflect the table's purpose: If *size* is an exact power of 2, the guard point will be a copy of the first point; this is appropriate for *interpolated wrap-around lookup* as in *oscili*, etc., and should even be used for non-interpolating *oscil* for safe consistency. If *size* is set to 2 ^{n} + 1, the guard point value automatically extends the contour of table values; this is appropriate for single-scan functions such in *envplx*, *oscil1*, *oscil1i*, etc.

Table space is allocated in primary memory, along with instrument data space. The maximum table number used to be 200. This has been changed to be limited by memory only. (Currently there is an internal soft limit of 300, this is automatically extended as required.)

An existing function table can be removed by an *f statement* containing a negative p1 and an appropriate action time. A function table can also be removed by the generation of another table with the same p1. Functions are not automatically erased at the end of a score section.

p2 action time is treated in the same way as in *i statement*s with respect to sorting and modification by *t statement*s. If an *f statement* and an *i statement* have the same p2, the sorter gives the *f statement* precedence so that the function table will be available during note initialization.

An *f 0 statement* (zero p1, positive p2) may be used to create an action time with no associated action. Such time markers are useful for padding out a score section (see *s statement*) and for letting csound run from realtime events only (e.g. using only MIDI input without score events).

The simplest way to fill a table (f1) with 0's is:

f1 0 xx 2 0

where xx = table size.

The simplest way to fill a table (f1) with *any* single value is:

f1 0 xx -7 yy xx yy

where xx = table size and yy = any single value

In both of the above examples, table size (p3) must be a power of 2 or power-of-2 plus 1.