tableng — Interrogates a function table for length.
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 448. Example of the tableng opcode.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform ; Audio out Audio in -odac -iadc ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o tableng.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> ; Initialize the global variables. sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ; Instrument #1. instr 1 ; Let's look at Table #1. ifn = 1 ilen tableng ifn print ilen endin </CsInstruments> <CsScore> ; Table #1, a sine wave. f 1 0 16384 10 1 ; Play Instrument #1 for one second. i 1 0 1 e </CsScore> </CsoundSynthesizer>
The table is 16,384 samples long. So its output should include a line like this:
instr 1: ilen = 16384.000