tableng — Interrogates a function table for length.


Interrogates a function table for length.


ires tableng ifn
kres tableng kfn


ifn -- Table number to be interrogated


kfn -- Table number to be interrogated

tableng returns the length of the specified table. This will be a power of two number in most circumstances. It will not show whether a table has a guardpoint or not. It seems this information is not available in the table's data structure. If the specified table is not found, then 0 will be returned.

Likely to be useful for setting up code for table manipulation operations, such as tablemix and tablecopy.


Here is an example of the tableng opcode. It uses the file tableng.csd.

Example 1098. Example of the tableng opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

; Select audio/midi flags here according to platform
-odac    ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o tableng.wav -W ;;; for file output any platform

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

gifn1 ftgen 1, 0, 0, 1, "flute.aiff", 0, 0, 0	;deferred-size table

instr 1 

isize tableng 1
print isize
andx  phasor 1 / (isize / sr)			;play at correct pitch
asig  tab andx, 1, 1
      outs asig, asig


i 1 0 2.3	

Its output should include a line like this:

instr 1:  isize = 115506.000

See also

Table Control:Table Queries


Author: Robin Whittle
May 1997