vcopy
Prev | Orchestra Opcodes and Operators | Next

## vcopy

vcopy — Copies between two vectorial control signals

## Description

Copies between two vectorial control signals

## Syntax

    vcopy  ifn1, ifn2, kelements [, kdstoffset] [, ksrcoffset] [, kverbose]

## Initialization

ifn1 - number of the table where the vectorial signal will be copied (destination)

ifn2 - number of the table hosting the vectorial signal to be copied (source)

## Performance

kelements - number of elements of the vector

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

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

kverbose - Selects whether or not warnings are printed (Default=0)

vcopy copies kelements elements from ifn2 (starting from position ksrcoffset) to ifn1 (starting from position kdstoffset). Useful to keep old vector values, by storing them in another table.

Negative values for kdstoffset and ksrcoffset are acceptable. If kdstoffset is negative, the out of range section of the vector will be discarded. If kdstoffset is negative, the out of range elements will be assumed to be 1 (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 1 (i.e. the destination vector will not be changed for these elements).

If the optional kverbose argument is different to 0, the opcode will print warning messages every k-pass if table lengths are exceeded.

| 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 k-rate (this means that every k-pass the vectors are copied). There's an i-rate version of this opcode called vcopy_i.

| Note
Please note that the elements argument has changed in version 5.03 from i-rate to k-rate. This will change the opcode's behavior in the unusual cases where the i-rate variable ielements is changed inside the instrument, for example in:
        instr 1
    ielements  =        10
               vadd     1, 1, ielements
    ielements  =        20
               vadd     2, 1, ielements
               turnoff
        endin

All these operators (vaddv, vsubv, vmultv, vdivv, vpowv, vexp, 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 vcopy opcode. It uses the file vcopy.csd.

Example 1069. Example of the vcopy opcode.

    <CsoundSynthesizer>
    <CsOptions>; Select audio/midi flags here according to platform
    ; Audio out   Audio in    No messages
    -odac           -iadc     -d     ;;;RT audio I/O
    ; For Non-realtime ouput leave only the line below:
    ; -o vcopy.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    sr=44100
    kr=4410
    ksmps=10
    nchnls=2

    	instr 1 ;table playback
    ar lposcil 1, 1, 0, 262144, 1
    outs ar,ar
    	endin

    	instr 2
    vcopy 2, 1, 20000 ;copy vector from sample to empty table
    vmult 5, 20000, 262144 ;scale noise to make it audible
    vcopy 1, 5, 20000  ;put noise into sample
    turnoff
    	endin

    	instr 3
    vcopy 1, 2, 20000 ;put original information back in
    turnoff
    	endin

    </CsInstruments>
    <CsScore>
    f1  0 262144   -1 "beats.wav" 0 4 0
    f2  0 262144   2  0

    f5  0 262144   21  3 30000

    i1 0 4
    i2 3 1

    s
    i1 0 4
    i3 3 1
    s

    i1 0 4

    </CsScore>
    </CsoundSynthesizer>

## Credits

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

New in Csound 5 (Previously available only on CsoundAV)

Prev | Up | Next
vcomb | Home | vcopy_i