The Alternative Csound Reference Manual
Previous |  | Next

# tablexkt

tablexkt -- Reads function tables with linear, cubic, or sinc interpolation.

## Description

Reads function tables with linear, cubic, or sinc interpolation.

## Syntax

ar tablexkt xndx, kfn, kwarp, iwsize [, ixmode] [, ixoff] [, iwrap]

## Initialization

iwsize -- This parameter controls the type of interpolation to be used:

- 2: Use linear interpolation. This is the lowest quality, but also the fastest mode.

- 4: Cubic interpolation. Slightly better quality than iwsize = 2, at the expense of being somewhat slower.

- 8 and above (up to 1024): sinc interpolation with window size set to iwsize (should be an integer multiply of 4). Better quality than linear or cubic interpolation, but very slow. When transposing up, a kwarp value above 1 can be used for anti-aliasing (this is even slower).

ixmode1 (optional) -- index data mode. The default value is 0.

- 0: raw index

- any non-zero value: normalized (0 to 1)

| Notes
| if tablexkt is used to play back samples with looping (e.g. table index is generated by lphasor), there must be at least iwsize / 2 extra samples after the loop end point for interpolation, otherwise audible clicking may occur (also, at least iwsize / 2 samples should be before the loop start point).

ixoff (optional) -- amount by which index is to be offset. For a table with origin at center, use tablesize / 2 (raw) or 0.5 (normalized). The default value is 0.

iwrap (optional) -- wraparound index flag. The default value is 0.

- 0: Nowrap (index < 0 treated as index = 0; index >= tablesize (or 1.0 in normalized mode) sticks at the guard point).

- any non-zero value: Index is wrapped to the allowed range (not including the guard point in this case).

| Note
| iwrap also applies to extra samples for interpolation.

## Performance

ar -- audio output

xndx -- table index

kfn -- function table number

kwarp -- if greater than 1, use sin (x / kwarp) / x function for sinc interpolation, instead of the default sin (x) / x. This is useful to avoid aliasing when transposing up (kwarp should be set to the transpose factor in this case, e.g. 2.0 for one octave), however it makes rendering up to twice as slow. Also, iwsize should be at least kwarp * 8. This feature is experimental, and may be optimized both in terms of speed and quality in new versions.

| Note
| kwarp has no effect if it is less than, or equal to 1, or linear or cubic interpolation is used.

## Credits

Author: Istvan Varga
January 2002

New in version 4.18

Previous | Home | Next
tablewkt | Up | tablexseg