tabw

tabw — Fast table opcodes.

Description

Fast table opcodes. Faster than tablew because it does not allow wrap-around and limit. Has been implemented in order to provide fast access to arrays.

Syntax

tabw ksig, kndx, ifn [,ixmode]
tabw asig, andx, ifn [,ixmode]

Initialization

ifn -- table number

ixmode -- defaults to zero. If zero xndx range matches the length of the table; if non zero xndx has a 0 to 1 range.

Performance

andx, kndx -- table index.

tabw opcode is similar to tablew but are faster, and use rounding of the index.

Special care of index value must be taken into account. Index values out of the table allocated space will crash Csound.

Examples

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

Example 1077. Example of the tabw 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
-odac      ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o tabw.wav -W ;;; for file output any platform

;By Stefano Cucchi 2024
</CsOptions>
<CsInstruments>

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

instr 1

tabw p4, 0, 2 ; write content of function number "2"
tabw p5, 1, 2
tabw p6, 2, 2
tabw p7, 3, 2
tabw p8, 4, 2

kamp oscili 1, 1/p3, 2 ;use f2 as envelope
asig poscil kamp, 440, 1		
     outs asig, asig

endin

</CsInstruments>
<CsScore>
f 1 0 8192 10 1 0.6 0 0.4 0.6	
f2 0 5 2 0 0 0 0 0

i1 0 3   0 0.9  0 0.2 0.9 ; every note has different envelope
i1 4 3   1 0.01 1 0.5  0
i1 8 3   1  1   0 0.5  0
e
</CsScore>
</CsoundSynthesizer>


See Also

Table Access

Credits

Written by Gabriel Maldonado.