vmap
Maps elements from a vector onto another according to indexes.
Syntax
Initialization
ifn1 - number of the table where the vectorial signal will be copied, and which contains the mapping vector
ifn2 - number of the table hosting the vectorial signal to be copied
ielements - number of elements to process
idstoffset - index offset for destination table (ifn1)
isrcoffset - index offset for source table (ifn2)
Performance
vmap maps elements of ifn2 according to the values of table ifn1. Elements of ifn1 are treated as indexes of table ifn2, so element values of ifn1 must not exceed the length of ifn2 table otherwise a Csound will report an error. Elements of ifn1 are treated as integers, so any fractional part will be truncated. There is no interpolation performed on this operation.
In practice, what happens is that the elements of ifn1 are used as indexes to ifn2, and then are replaced by the corresponding elements from ifn2. ifn1 must be different from ifn2, otherwise the results are unpredictable. Csound will produce an init error if they are not.
All these operators (vaddv, vsubv, vmultv, vdivv, vpowv, vexpv, vcopy and vmap) are designed to be used together with other opcodes that operate with vectorial signals such as, vcella, adsynt, adsynt2, etc.
Examples
Here is an example of the vmap opcode. It uses the file vmap.csd.
See also
Operations Between two Vectorial Signals
Credits
Written by Gabriel Maldonado.
New in Csound 5 (Previously available only on CsoundAV)