vtablewk
Prev | Orchestra Opcodes and Operators | Next

## vtablewk

vtablewk — Write vectors (to tables -or arrays of vectors).

## Description

This opcode writes vectors to tables at k-rate.

## Syntax

    vtablewk  kndx, kfn, ixmode, kinarg1 [, kinarg2, kinarg3 , .... , kinargN ]

## Initialization

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).

## Performance

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

kfn - table number

kinarg1...kinargN - input vector elements

This opcode is useful in all cases in which one needs to write 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 (kinarg1, kinarg2, kinarg3, .... kinargN).

vtablewk allows also to switch the table number at k-rate (but this is possible only when vector frames of each used table have the same number of elements, otherwise unpredictable results could occurr), as well as to choose indexing style (raw or normalized, see also ixmode argument of table opcode ).

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 vtablewk, in order to correct eventual out-of-range values.

## Examples

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

Example 936. Example of the vtablewk opcode.

    <CsoundSynthesizer>
    <CsOptions>
    ;-ovtablewa.wav -W -b441 -B441
    -odac -b441 -B441
    </CsOptions>
    <CsInstruments>

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

    	instr 1
    ilen = ftlen (1)

    knew1 oscil 10000, 440, 3
    knew2 oscil 15000, 440, 3, 0.5
    kindex phasor 0.3
    asig oscil 1, sr/ilen , 1
    vtablewk kindex*ilen, 1, 0, knew1, knew2
    out asig,asig
    	endin

    </CsInstruments>
    <CsScore>
    f1  0 262144   -1 "beats.aiff" 0 4 0
    f2  0 262144   2  0
    f3  0 1024  10 1

    i1 0 10
    </CsScore>
    </CsoundSynthesizer>

## Credits

Written by Gabriel Maldonado.

Example written by Andres Cabrera.

New in Csound 5 (Previously available only on CsoundAV)

Prev | Up | Next
vtablewi | Home | vtablewa