tablekt

tablekt — Provides k-rate control over table numbers.

Description

k-rate control over table numbers.

The standard Csound opcode table when producing a k- or a-rate result, can only use an init-time variable to select the table number. tablekt accepts k-rate control as well as i-time. In all other respects they are similar to the original opcodes.

Syntax

ares tablekt xndx, kfn [, ixmode] [, ixoff] [, iwrap]
kres tablekt kndx, kfn [, ixmode] [, ixoff] [, iwrap]

Initialization

ixmode -- if 0, xndx and ixoff ranges match the length of the table. if non-zero xndx and ixoff have a 0 to 1 range. Default is 0

ixoff -- if 0, total index is controlled directly by xndx, ie. the indexing starts from the start of the table. If non-zero, start indexing from somewhere else in the table. Value must be positive and less than the table length (ixmode = 0) or less than 1 (ixmode not equal to 0). Default is 0.

iwrap -- if iwrap = 0, Limit mode: when total index is below 0, then final index is 0.Total index above table length results in a final index of the table length - high out of range total indexes stick at the upper limit of the table. If iwrap not equal to 0, Wrap mode: total index is wrapped modulo the table length so that all total indexes map into the table. For instance, in a table of length 8, xndx = 5 and ixoff = 6 gives a total index of 11, which wraps to a final index of 3. Default is 0.

Performance

kndx -- Index into table, either a positive number range

xndx -- matching the table length (ixmode = 0) or a 0 to 1 range (ixmode not equal to 0)

kfn -- Table number. Must be >= 1. Floats are rounded down to an integer. If a table number does not point to a valid table, or the table has not yet been loaded (GEN01) then an error will result and the instrument will be de-activated.

[Caution] Caution with k-rate table numbers

At k-rate, if a table number of < 1 is given, or the table number points to a non-existent table, or to one which has a length of 0 (it is to be loaded from a file later) then an error will result and the instrument will be deactivated. kfn must be initialized at the appropriate rate using init. Attempting to load an i-rate value into kfn will result in an error.

See Also

tableikt

Credits

Author: Robin Whittle
Australia
May 1997

New in version 3.47