summaryrefslogtreecommitdiff
path: root/opcodes/vexp.xml
blob: 91f6729b29fe1cdf9b09a0a3d2514049b89d604d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<refentry id="vexp">
<indexterm id="IndexVexp"><primary>vexp</primary></indexterm>
  <refentryinfo><title>Vectorial:Scalar operations</title></refentryinfo>
  <refmeta>
    <refentrytitle>vexp</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>vexp</refname>
    <refpurpose>
      Performs power-of operations between a vector and a scalar
    </refpurpose>
  </refnamediv>

  <refsect1>
    <title>Description</title>
    <para>
      Performs power-of operations between a vector and a scalar
    </para>
  </refsect1>
  
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>vexp</command>  ifn, kval, kelements [, kdstoffset] [, kverbose]</synopsis>
  </refsect1>

  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>ifn</emphasis>  - number of the table hosting the vectorial signal to be processed
    </para>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>kval</emphasis> - scalar operand to be processed
    </para>
    <para>
      <emphasis>kelements</emphasis> - number of elements of the vector
    </para>
    <para>
      <emphasis>kdstoffset</emphasis> - index offset for the destination table (Optional, default = 0)
    </para>
    <para>
      <emphasis>kverbose</emphasis> - Selects whether or not warnings are printed (Default=0)
    </para>
    <para>
      <emphasis>vexp</emphasis> rises <emphasis>kval</emphasis> to each element contained in a vector from table <emphasis>ifn</emphasis>,starting from table index <emphasis>kdstoffset</emphasis>. This enables you to process a specific section of a table by specifying the offset and the number of elements to be processed. Offset is counted starting from 0, so if no offset is specified (or set to 0), the table will be modified from the beginning.
    </para><para>
      Note that this opcode runs at k-rate so the value of <emphasis>kval</emphasis> is processed every control period. Use with care or you will end up with very large (or small) numbers (or use <link linkend="vexp_i"><citetitle>vexp_i</citetitle></link>).
    </para>
    <para>
      These opcodes (<link linkend="vadd"><citetitle>vadd</citetitle></link>, <link linkend="vmult"><citetitle>vmult</citetitle></link>, <link linkend="vpow"><citetitle>vpow</citetitle></link> and <link linkend="vexp"><citetitle>vexp</citetitle></link>) perform numeric operations between a vectorial control signal (hosted by the table <emphasis>ifn</emphasis>), and a scalar signal (<emphasis>kval</emphasis>). Result is a new vector that overrides old values of <emphasis>ifn</emphasis>. All these opcodes work at k-rate.
    </para>
    <para>
      Negative values for <emphasis>kdstoffset</emphasis> are valid. Elements from the vector that are outside the table, will be discarded, and they will not wrap around the table.
    </para>
    <para>
      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.
    </para>
    <para>
      In all these opcodes, the resulting vectors are stored in <emphasis>ifn</emphasis>, overriding the intial vectors. If you want to keep initial vector, use <link linkend="vcopy"><citetitle>vcopy</citetitle></link> or <link linkend="vcopy_i"><citetitle>vcopy_i</citetitle></link> to copy it in another table. All these operators are designed to be used together with other opcodes that operate with vectorial signals such as <emphasis>bmscan</emphasis>, <link linkend="vcella"><citetitle>vcella</citetitle></link>, <link linkend="adsynt"><citetitle>adsynt</citetitle></link>, <link linkend="adsynt2"><citetitle>adsynt2</citetitle></link>, etc.  They can also be useful in conjunction with the spectral opcodes <link linkend="pvsftw"><citetitle>pvsftw</citetitle></link> and <link linkend="pvsftr"><citetitle>pvsftr</citetitle></link>.
    </para>
    <note>
      <para>
        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:
        <programlisting>
    <emphasis role="oblock">instr</emphasis> 1
ielements  <emphasis role="op">=</emphasis>        10
           <emphasis role="opc">vadd</emphasis>     1, 1, ielements
ielements  <emphasis role="op">=</emphasis>        20
           <emphasis role="opc">vadd</emphasis>     2, 1, ielements
           <emphasis role="opc">turnoff</emphasis>
    <emphasis role="oblock">endin</emphasis></programlisting>
      </para>
    </note>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the vexp opcode. It uses the file <ulink url="examples/vexp.csd"><citetitle>vexp.csd</citetitle></ulink>.

      <example>
        <title>Example of the vexp opcode.</title>
        <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>
        <xi:include href="examples-xml/vexp.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
      </example>
    </para>
  </refsect1>
  
  <refsect1>
    <title>Credits</title>
    <para>Written by Gabriel Maldonado. Optional arguments added by Andres Cabrera and Istvan Varga.</para>
    <para>New in Csound 5 (Previously available only on CsoundAV)</para>
  </refsect1>
</refentry>