The Alternative Csound Reference Manual
Previous |  | Next

# f Statement (or Function Table Statement)

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

## Description

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

## Syntax

f p1 p2 p3 p4 ...

## Performance

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.

### Special Considerations

Function tables are arrays of floating-point values. Arrays can be of any length in powers of 2; space allocation always provides for 2n 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 statements with respect to sorting and modification by t statements. 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).

## Credits

Updated August 2002 thanks to a note from Rasmus Ekman. There is no longer a hard limit of 200 function tables.

Previous | Home | Next
e Statement | Up | i Statement (Instrument or Note Statement)