Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > b707d9a4ee443103660a75ccb6e51334 > files > 2789

csound-doc-5.19.01-10.mga5.noarch.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>vaddv</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="vadd_i.html" title="vadd_i" />
    <link rel="next" href="vaddv_i.html" title="vaddv_i" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">vaddv</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="vadd_i.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="vaddv_i.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="vaddv">
      <a id="vaddv"></a>
      <div class="titlepage"></div>
      <a id="IndexVaddv" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">vaddv</span>
        </h2>
        <p>vaddv — 
      Performs addition between two vectorial control signals.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp50022976"></a>
        <h2>Description</h2>
        <p>
      Performs addition between two vectorial control signals.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp50023648"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>vaddv</strong></span>  ifn1, ifn2, kelements [, kdstoffset] [, ksrcoffset] [,kverbose]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp50077456"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifn1</em></span>  - number of the table hosting the first vector to be processed
    </p>
        <p>
      <span class="emphasis"><em>ifn2</em></span>  - number of the table hosting the second vector to be processed
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp50078800"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kelements</em></span> - number of elements of the two vectors
    </p>
        <p>
      <span class="emphasis"><em>kdstoffset</em></span> - index offset for the destination (<span class="emphasis"><em>ifn1</em></span>) table (Default=0)
    </p>
        <p>
      <span class="emphasis"><em>ksrcoffset</em></span> - index offset for the source (<span class="emphasis"><em>ifn2</em></span>) table (Default=0)
    </p>
        <p>
      <span class="emphasis"><em>kverbose</em></span> - Selects whether or not warnings are printed (Default=0)
    </p>
        <p>
      <span class="emphasis"><em>vaddv</em></span> adds two vectorial control signals, that is, each element of the first vector is processed (only) with the corresponding element of the other vector. Each vectorial signal is hosted by a table (<span class="emphasis"><em>ifn1</em></span> and <span class="emphasis"><em>ifn2</em></span>). The number of elements contained in both vectors must be the same.
    </p>
        <p>
      The result is a new vectorial control signal that overrides old values of ifn1. If you want to keep the old ifn1 vector, use <a class="link" href="vcopy_i.html" title="vcopy_i"><em class="citetitle">vcopy_i</em></a>opcode to copy it in another table. You can use <span class="emphasis"><em>kdstoffset</em></span> and <span class="emphasis"><em>ksrcoffset</em></span> to specify vectors in any location of the tables.
    </p>
        <p>
      Negative values for <span class="emphasis"><em>kdstoffset</em></span> and <span class="emphasis"><em>ksrcoffset</em></span> are acceptable. If <span class="emphasis"><em>kdstoffset</em></span> is negative, the out of range section of the vector will be discarded. If <span class="emphasis"><em>ksrcoffset</em></span> 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).
    </p>
        <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Warning">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Warning]" src="images/warning.png" />
              </td>
              <th align="left">Warning</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        Using the same table as source and destination table in versions earlier than 5.04, might produce unexpected behavior, so use with care.
      </p>
              </td>
            </tr>
          </table>
        </div>
        <p>
      This opcode works at k-rate (this means that every k-pass the vectors are added). There's an i-rate version of this opcode called <a class="link" href="vaddv_i.html" title="vaddv_i"><em class="citetitle">vaddv_i</em></a>.
    </p>
        <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Note</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        Please note that the <span class="emphasis"><em>elements</em></span> 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 <span class="emphasis"><em>ielements</em></span> is changed inside the instrument, for example in:
        </p>
                <pre class="programlisting">
    <span class="oblock">instr</span> 1
ielements  <span class="op">=</span>        10
           <span class="opc">vadd</span>     1, 1, ielements
ielements  <span class="op">=</span>        20
           <span class="opc">vadd</span>     2, 1, ielements
           <span class="opc">turnoff</span>
    <span class="oblock">endin</span></pre>
                <p>
      </p>
              </td>
            </tr>
          </table>
        </div>
        <p>
      All these operators (<a class="link" href="vaddv.html" title="vaddv"><em class="citetitle">vaddv</em></a>,<a class="link" href="vsubv.html" title="vsubv"><em class="citetitle">vsubv</em></a>,<a class="link" href="vmultv.html" title="vmultv"><em class="citetitle">vmultv</em></a>,<a class="link" href="vdivv.html" title="vdivv"><em class="citetitle">vdivv</em></a>,<a class="link" href="vpowv.html" title="vpowv"><em class="citetitle">vpowv</em></a>,<a class="link" href="vexpv.html" title="vexpv"><em class="citetitle">vexpv</em></a>, <a class="link" href="vcopy.html" title="vcopy"><em class="citetitle">vcopy</em></a> and <a class="link" href="vmap.html" title="vmap"><em class="citetitle">vmap</em></a>) are designed to be used together with other opcodes that operate with vectorial signals such as <span class="emphasis"><em>bmscan</em></span>, <a class="link" href="vcella.html" title="vcella"><em class="citetitle">vcella</em></a>, <a class="link" href="adsynt.html" title="adsynt"><em class="citetitle">adsynt</em></a>, <a class="link" href="adsynt2.html" title="adsynt2"><em class="citetitle">adsynt2</em></a> etc. 
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp50096440"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the vaddv opcode. It uses the file <a class="ulink" href="examples/vaddv.csd" target="_top"><em class="citetitle">vaddv.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp50097408"></a>
          <p class="title">
            <strong>Example 915. Example of the vaddv opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in</span>
-odac           -iadc     -nm0 <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o cigoto.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>


<span class="ohdr">sr</span><span class="op">=</span>44100
<span class="ohdr">ksmps</span><span class="op">=</span>128
<span class="ohdr">nchnls</span><span class="op">=</span>2

  <span class="oblock">opcode</span> TableDumpSimp, 0, ijo
<span class="comment">;prints the content of a table in a simple way</span>
ifn, iprec, ippr   <span class="opc">xin</span><span class="comment">; function table, float precision while printing (default = 3), parameters per row (default = 10, maximum = 32)</span>
iprec		<span class="op">=</span>		(iprec <span class="op">==</span> <span class="op">-</span>1 <span class="op">?</span> 3 <span class="op">:</span> iprec)
ippr		<span class="op">=</span>		(ippr <span class="op">==</span> 0 <span class="op">?</span> 10 <span class="op">:</span> ippr)
iend		<span class="op">=</span>		<span class="opc">ftlen</span>(ifn)
indx		<span class="op">=</span>		0
Sformat	<span class="opc">sprintf</span>	"<span class="op">%</span><span class="op">%</span>.<span class="op">%</span>df\t", iprec
Sdump		<span class="op">=</span>		""
<span class="olabel">loop</span><span class="op">:</span>
ival		<span class="opc">tab_i</span>		indx, ifn
Snew		<span class="opc">sprintf</span>	Sformat, ival
Sdump		<span class="opc">strcat</span>		Sdump, Snew
indx		<span class="op">=</span>		indx <span class="op">+</span> 1
imod		<span class="op">=</span>		indx <span class="op">%</span> ippr
	<span class="octrl">if</span> imod <span class="op">==</span> 0 then
		<span class="opc">puts</span>		Sdump, 1
Sdump		<span class="op">=</span>		""
	<span class="octrl">endif</span>
	<span class="octrl">if</span> indx <span class="op">&lt;</span> iend <span class="octrl">igoto</span> <span class="olabel">loop</span>
		<span class="opc">puts</span>		Sdump, 1
  <span class="oblock">endop</span>

	<span class="oblock">instr</span> 1
ifn1 <span class="op">=</span> p4
ifn2 <span class="op">=</span> p5
ielements <span class="op">=</span> p6
idstoffset <span class="op">=</span> p7
isrcoffset <span class="op">=</span> p8
kval <span class="opc">init</span> 25
<span class="opc">vaddv</span> ifn1, ifn2, ielements, idstoffset, isrcoffset, 1
<span class="opc">turnoff</span>
	<span class="oblock">endin</span>

	<span class="oblock">instr</span> 2
TableDumpSimp p4, 3, 16
	<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">f</span> 1 0 16 -7 1 15 16

<span class="stamnt">f</span> 2 0 16 -7 1 15 2


<span class="stamnt">i</span>2	0.0	0.2	1
<span class="stamnt">i</span>2	0.2	0.2	2
<span class="stamnt">i</span>1	0.4	0.01	1	2	5	3	8	
<span class="stamnt">i</span>2	0.8	0.2	1
<span class="stamnt">i</span>1	1.0	0.01	1	2	5	10	-2	
<span class="stamnt">i</span>2	1.2	0.2	1
<span class="stamnt">i</span>1	1.4	0.01	1	2	8	14	0	
<span class="stamnt">i</span>2	1.6	0.2	1
<span class="stamnt">i</span>1	1.8	0.01	1	2	8	0	14	
<span class="stamnt">i</span>2	2.0	0.2	1	
<span class="stamnt">i</span>1	2.2	0.002	1	1	8	5	2	
<span class="stamnt">i</span>2	2.4	0.2	1
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp50099680"></a>
        <h2>Credits</h2>
        <p>Written by Gabriel Maldonado. Optional arguments added by Andres Cabrera and Istvan Varga.</p>
        <p>New in Csound 5 (Previously available only on CsoundAV)</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="vadd_i.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="vaddv_i.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">vadd_i </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> vaddv_i</td>
        </tr>
      </table>
    </div>
  </body>
</html>