vsubv_i — Performs subtraction between two vectorial control signals at init time.


Performs subtraction between two vectorial control signals at init time.


vsubv_i  ifn1, ifn2, ielements [, idstoffset] [, isrcoffset]


ifn1 - number of the table hosting the first vector to be processed

ifn2 - number of the table hosting the second vector to be processed

ielements - number of elements of the two vectors

idstoffset - index offset for the destination (ifn1) table (Default=0)

isrcoffset - index offset for the source (ifn2) table (Default=0)


vsubv_i subtracts two vectorial control signals, that is, each element of ifn2 is subrtacted from the corresponding element of ifn1. Each vectorial signal is hosted by a table (ifn1 and ifn2). The number of elements contained in both vectors must be the same.

The result is a new vectorial control signal that overrides old values of ifn1. If you want to keep the old ifn1 vector, use vcopy_i opcode to copy it in another table. You can use idstoffset and isrcoffset to specify vectors in any location of the tables.

Negative values for idstoffset and isrcoffset are acceptable. If idstoffset is negative, the out of range section of the vector will be discarded. If isrcoffset is negative, the out of range elements will be assumed to be 0 (i.e. the destination elements will not be changed). If elements for the destination vector are beyond the size of the table (including guard point), these elements are discarded (i.e. elements do not wrap around the tables). If elements for the source vector are beyond the table length, these elements are taken as 0 (i.e. the destination vector will not be changed for these elements).

[Warning] Warning

Using the same table as source and destination table in versions earlier than 5.04, might produce unexpected behavior, so use with care.

This opcode works at init time. There is an k-rate version of this opcode called vsubv.

All these operators (vaddv_i,vsubv_i,vmultv_i,vdivv_i,vpowv_i,vexpv_i, vcopy and vmap) are designed to be used together with other opcodes that operate with vectorial signals such as vcella, adsynt, adsynt2 etc.

See also

Operations Between two Vectorial Signals


Written by Gabriel Maldonado. Optional arguments added by Andres Cabrera and Istvan Varga.

New in Csound 5 (Previously available only on CsoundAV)