Debian Codegraph @

opcodes/vsubv.xml

raw symbols SCIP
1
2 <refentry id="vsubv">
3 <indexterm id="IndexVsubv"><primary>vsubv</primary></indexterm>
4 <refentryinfo><title>Vectorial:Vectorial operations</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>vsubv</refentrytitle>
7 </refmeta>
8
9 <refnamediv>
10 <refname>vsubv</refname>
11 <refpurpose>
12 Performs subtraction between two vectorial control signals
13 </refpurpose>
14 </refnamediv>
15
16 <refsect1>
17 <title>Description</title>
18 <para>
19 Performs subtraction between two vectorial control signals
20 </para>
21 </refsect1>
22
23 <refsect1>
24 <title>Syntax</title>
25 <synopsis><command>vsubv</command> ifn1, ifn2, kelements [, kdstoffset] [, ksrcoffset] [,kverbose]</synopsis>
26 </refsect1>
27
28 <refsect1>
29 <title>Initialization</title>
30 <para>
31 <emphasis>ifn1</emphasis> - number of the table hosting the first vector to be processed
32 </para>
33 <para>
34 <emphasis>ifn2</emphasis> - number of the table hosting the second vector to be processed
35 </para>
36 </refsect1>
37
38 <refsect1>
39 <title>Performance</title>
40 <para>
41 <emphasis>kelements</emphasis> - number of elements of the two vectors
42 </para>
43 <para>
44 <emphasis>kdstoffset</emphasis> - index offset for the destination (<emphasis>ifn1</emphasis>) table (Default=0)
45 </para>
46 <para>
47 <emphasis>ksrcoffset</emphasis> - index offset for the source (<emphasis>ifn2</emphasis>) table (Default=0)
48 </para>
49 <para>
50 <emphasis>kverbose</emphasis> - Selects whether or not warnings are printed (Default=0)
51 </para>
52 <para>
53 <emphasis>vsubv</emphasis> subtracts two vectorial control signals, that is, each element of <emphasis>ifn2</emphasis> is substracted from the corresponding element of <emphasis>ifn1</emphasis>. Each vectorial signal is hosted by a table (<emphasis>ifn1</emphasis> and <emphasis>ifn2</emphasis>). The number of elements contained in both vectors must be the same.
54 </para>
55 <para>
56 The result is a new vectorial control signal that overrides old values of <emphasis>ifn1</emphasis>. If you want to keep the old <emphasis>ifn1</emphasis> vector, use <link linkend="vcopy_i"><citetitle>vcopy_i</citetitle></link> opcode to copy it in another table. You can use <emphasis>kdstoffset</emphasis> and <emphasis>ksrcoffset</emphasis> to specify vectors in any location of the tables.
57 </para>
58 <para>
59 Negative values for <emphasis>kdstoffset</emphasis> and <emphasis>ksrcoffset</emphasis> are acceptable. If <emphasis>kdstoffset</emphasis> is negative, the out of range section of the vector will be discarded. If <emphasis>ksrcoffset</emphasis> 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).
60 </para>
61 <para>
62 If the optional <emphasis>kverbose</emphasis> argument is different to 0, the opcode will print warning messages every k-pass if table lengths are exceeded.
63 </para>
64 <warning>
65 <para>
66 Using the same table as source and destination table in versions earlier than 5.04, might produce unexpected behavior, so use with care.
67 </para>
68 </warning>
69 <para>
70 This opcode works at k-rate (this means that every k-pass the
71 vectors are subtracted). There is an i-rate version of this opcode called <link linkend="vsubv_i"><citetitle>vsubv_i</citetitle></link>.
72 </para>
73 <note>
74 <para>
75 Please note that the <emphasis>elements</emphasis> 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 <emphasis>ielements</emphasis> is changed inside the instrument, for example in:
76 <programlisting>
77 <emphasis role="oblock">instr</emphasis> 1
78 ielements <emphasis role="op">=</emphasis> 10
79 <emphasis role="opc">vadd</emphasis> 1, 1, ielements
80 ielements <emphasis role="op">=</emphasis> 20
81 <emphasis role="opc">vadd</emphasis> 2, 1, ielements
82 <emphasis role="opc">turnoff</emphasis>
83 <emphasis role="oblock">endin</emphasis></programlisting>
84 </para>
85 </note>
86 <para>
87 All these operators (<link linkend="vaddv"><citetitle>vaddv</citetitle></link>, <link linkend="vsubv"><citetitle>vsubv</citetitle></link>, <link linkend="vmultv"><citetitle>vmultv</citetitle></link>, <link linkend="vdivv"><citetitle>vdivv</citetitle></link>, <link linkend="vpowv"><citetitle>vpowv</citetitle></link>, <link linkend="vexpv"><citetitle>vexpv</citetitle></link>, <link linkend="vcopy"><citetitle>vcopy</citetitle></link> and <link linkend="vmap"><citetitle>vmap</citetitle></link>) are designed to be used together with other opcodes that operate with vectorial signals such as <link linkend="vcella"><citetitle>vcella</citetitle></link>, <link linkend="adsynt"><citetitle>adsynt</citetitle></link>, <link linkend="adsynt2"><citetitle>adsynt2</citetitle></link>, etc.
88 </para>
89 </refsect1>
90
91 <refsect1>
92 <title>Examples</title>
93 <para>
94 Here is an example of the vsubv opcode. It uses the file <ulink url="examples/vsubv.csd"><citetitle>vsubv.csd</citetitle></ulink>.
95
96 <example>
97 <title>Example of the vsubv opcode.</title>
98 <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para>
99 <xi:include href="examples-xml/vsubv.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
100 </example>
101 </para>
102 </refsect1>
103
104 <refsect1>
105 <title>See also</title>
106 <para><link linkend="vectorialvectorial"><citetitle>Operations Between two Vectorial Signals</citetitle></link></para>
107 </refsect1>
108
109 <refsect1>
110 <title>Credits</title>
111 <para>Written by Gabriel Maldonado. Optional arguments added by Andres Cabrera and Istvan Varga.</para>
112 <para>New in Csound 5 (Previously available only on CsoundAV)</para>
113 </refsect1>
114 </refentry>