vtablei

vtablei — Read vectors (from tables -or arrays of vectors).

Description

This opcode reads vectors from tables.

Syntax

vtablei  indx, ifn, interp, ixmode, iout1 [, iout2, iout3, .... , ioutN ]

Initialization

indx - Index into f-table, either a positive number range matching the table length (ixmode = 0) or a 0 to 1 range (ixmode != 0).

ifn - table number

iout1...ioutN - output vector elements

ixmode - index data mode. The default value is 0.

== 0 index is treated as a raw table location,

== 1 index is normalized (0 to 1).

interp - vtable (vector table) family of opcodes allows the user to switch beetween interpolated or non-interpolated output by means of the interp argument.

Performance

This opcode is useful in all cases in which one needs to access sets of values associated to unique indexes (for example, multi-channel samples, STFT bin frames, spectral formants, p-field based scores etc.). The number of elements of each vector (length of the vector) is determined by the number of optional arguments on the right (iout1 , iout2, iout3, .... ioutN).

vtable (vector table) family of opcodes allows the user to switch beetween interpolated or non-interpolated output by means of the interp argument.

Notice that no wrap nor limit mode is implemented. So, if an index attempt to access to a zone not allocated by the table, Csound will probably crash. However this drawback can be easily avoided by using wrap or limit opcodes applied to indexes before using vtable, in order to correct eventual out-of-range values.

[Note] Note

Notice that vtablei's output arguments are placed at the right of the opcode name, differently from usual (this style is already used in other opcodes using undefined lists of output arguments such as fin or trigseq).

Examples

Here is an example of the vtablei opcode. It uses the files vtablei.csd

Example 511. Example of the vtablei opcode.

<CsoundSynthesizer>
<CsOptions>
-odac -B441 -b441
</CsOptions>
<CsInstruments>

sr     =        44100
kr     =        100
ksmps  =        441
nchnls =        2

gindx init 0

       instr    1
kindex init 0
ktrig metro 0.5
if ktrig = 0 goto noevent
event "i", 2, 0, 0.5, kindex
kindex = kindex + 1
noevent:

	endin

	instr	2
iout1 init 0
iout2 init 0
iout3 init 0
iout4 init 0
indx = p4
vtablei  indx, 1, 1, 0, iout1,iout2, iout3, iout4
print iout1, iout2, iout3, iout4
turnoff
	endin

</CsInstruments>
<CsScore>
f 1 0 32 10 1
i 1 0 20

</CsScore>
</CsoundSynthesizer>


See also

vtablea, vtablek, vtabi, vtablewi, vtabwi,

Credits

Example written by Andres Cabrera.

New in Csound 5 (Previously available only on CsoundAV)