Sophie

Sophie

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

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>vpow</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="vport.html" title="vport" />
    <link rel="next" href="vpow_i.html" title="vpow_i" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">vpow</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="vport.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="vpow_i.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="vpow">
      <a id="vpow"></a>
      <div class="titlepage"></div>
      <a id="IndexVpow" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">vpow</span>
        </h2>
        <p>vpow — 
      Raises each element of a vector to a scalar power.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp52583752"></a>
        <h2>Description</h2>
        <p>
       Raises each element of a vector to a scalar power.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp52584416"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>vpow</strong></span>  ifn, kval, kelements [, kdstoffset] [, kverbose]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp52619320"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifn</em></span>  - number of the table hosting the vectorial signal to be processed
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp52620192"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kval</em></span> - scalar value to which the elements of <span class="emphasis"><em>ifn</em></span> will be raised
    </p>
        <p>
      <span class="emphasis"><em>kelements</em></span> - number of elements of the vector
    </p>
        <p>
      <span class="emphasis"><em>kdstoffset</em></span> - index offset for the destination table (Optional, 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>vpow</em></span> raises each element of the vector contained in the table <span class="emphasis"><em>ifn</em></span> to the power of <span class="emphasis"><em>kval</em></span>, starting from table index <span class="emphasis"><em>kdstoffset</em></span>. 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.
    </p>
        <p>
      Note that this opcode runs at k-rate so the value of <span class="emphasis"><em>kval</em></span> is processed every control period. Use with care or you will end up with very large (or small) numbers (or use <a class="link" href="vpow_i.html" title="vpow_i"><em class="citetitle">vpow_i</em></a>).
    </p>
        <p>
      These opcodes (<a class="link" href="vadd.html" title="vadd"><em class="citetitle">vadd</em></a>, <a class="link" href="vmult.html" title="vmult"><em class="citetitle">vmult</em></a>, <a class="link" href="vpow.html" title="vpow"><em class="citetitle">vpow</em></a> and <a class="link" href="vexp.html" title="vexp"><em class="citetitle">vexp</em></a>) perform numeric operations between a vectorial control signal (hosted by the table <span class="emphasis"><em>ifn</em></span>), and a scalar signal (<span class="emphasis"><em>kval</em></span>). Result is a new vector that overrides old values of <span class="emphasis"><em>ifn</em></span>. All these opcodes work at k-rate.
    </p>
        <p>
      Negative values for <span class="emphasis"><em>kdstoffset</em></span> are valid. Elements from the vector that are outside the table, will be discarded, and they will not wrap around the table.
    </p>
        <p>
      If the optional <span class="emphasis"><em>kverbose</em></span> argument is different to 0, the opcode will print warning messages every k-pass if table lengths are exceeded.
    </p>
        <p>
      In all these opcodes, the resulting vectors are stored in <span class="emphasis"><em>ifn</em></span>, overriding the intial vectors. If you want to keep initial vector, use <a class="link" href="vcopy.html" title="vcopy"><em class="citetitle">vcopy</em></a> or <a class="link" href="vcopy_i.html" title="vcopy_i"><em class="citetitle">vcopy_i</em></a> 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 <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.  They can also be useful in conjunction with the spectral opcodes <a class="link" href="pvsftw.html" title="pvsftw"><em class="citetitle">pvsftw</em></a> and <a class="link" href="pvsftr.html" title="pvsftr"><em class="citetitle">pvsftr</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>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp52637048"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the vpow opcode. It uses the file <a class="ulink" href="examples/vpow.csd" target="_top"><em class="citetitle">vpow.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp52638016"></a>
          <p class="title">
            <strong>Example 963. Examples of the vpow 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     <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">instr</span> 1
ifn1 <span class="op">=</span> p4
ival <span class="op">=</span> p5
ielements <span class="op">=</span> p6
idstoffset <span class="op">=</span> p7
kval <span class="opc">init</span> 25
<span class="opc">vpow</span> ifn1, ival, ielements, idstoffset, 1
	<span class="oblock">endin</span>

	<span class="oblock">instr</span> 2	<span class="comment">;Printtable</span>
itable <span class="op">=</span> p4
isize <span class="op">=</span> <span class="opc">ftlen</span>(itable)
kcount <span class="opc">init</span> 0
kval <span class="opc">table</span> kcount, itable
<span class="opc">printk2</span> kval

<span class="octrl">if</span> (kcount <span class="op">==</span> isize) then
  <span class="opc">turnoff</span>
<span class="octrl">endif</span>

kcount <span class="op">=</span> kcount <span class="op">+</span> 1 
	<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 16 17

<span class="stamnt">i</span>2	0.0	0.2	1
<span class="stamnt">i</span>1	0.4	0.01	1	2	3	4
<span class="stamnt">i</span>2	0.8	0.2	1
<span class="stamnt">i</span>1	1.0	0.01	1	0.5	5	-3
<span class="stamnt">i</span>2	1.2	0.2	1
<span class="stamnt">i</span>1	1.4	0.01	1	1.5	10	12
<span class="stamnt">i</span>2	1.6	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>
        <p>
      Here is another example of the vpow opcode. It uses the file <a class="ulink" href="examples/vpow-2.csd" target="_top"><em class="citetitle">vpow-2.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp52640824"></a>
          <p class="title">
            <strong>Example 964. </strong>
          </p>
          <div class="example-contents">
            <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>
-odac  <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o vpow-2.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> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1

ain   <span class="opc">diskin2</span> "fox.wav", 1				<span class="comment">;soundfile</span>
fsrc  <span class="opc">pvsanal</span> ain, 1024, 256, 1024, 1
ifn   <span class="ohdr">ftgen</span>   0, 0, 1024<span class="op">/</span>2, 2, 0			<span class="comment">;create empty function table for the 513 bins</span>
kflag <span class="opc">pvsftw</span> fsrc,ifn					<span class="comment">;export only amplitudes to table	</span>
kval  <span class="opc">line</span> .001, p3, 1					<span class="comment">;start with big distortion, cahnge over note duration to clean sound</span>
kbin  <span class="opc">line</span> p4, p3, p5					<span class="comment">;vary the bins</span>
<span class="opc">vpow</span>  ifn, kval, kbin, 0				<span class="comment">;note that this operation is applied each k-cycle!</span>
<span class="comment">;vpow ifn, kval, kbin, 10				;if you set kdstoffset to 10 it will affect bins 10+(kbin line p4, p3, p5)</span>
      <span class="opc">pvsftr</span>  fsrc,ifn					<span class="comment">;read modified data back to fsrc</span>
aout  <span class="opc">pvsynth</span> fsrc					<span class="comment">;and resynth</span>
      <span class="opc">outs</span> aout<span class="op">*</span>p6, aout<span class="op">*</span>p6				<span class="comment">;adjust volume to compensate</span>

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

<span class="stamnt">i</span> 1 0 4 100 100 .02	<span class="comment">;first 100 bins are affected</span>
<span class="stamnt">i</span> 1 + 4 10  10  .1	<span class="comment">;first 10 bins</span>
<span class="stamnt">i</span> 1 + 4 1 400	.05	<span class="comment">;sweep from bin 1 to 400</span>
<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="See also">
        <a id="idp52641600"></a>
        <h2>See also</h2>
        <p>
      <a class="link" href="vadd.html" title="vadd"><em class="citetitle">vadd_i</em></a>, <a class="link" href="vmult.html" title="vmult"><em class="citetitle">vmult</em></a>, <a class="link" href="vpow_i.html" title="vpow_i"><em class="citetitle">vpow</em></a> and <a class="link" href="vexp.html" title="vexp"><em class="citetitle">vexp</em></a>.
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp52644040"></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="vport.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="vpow_i.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">vport </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> vpow_i</td>
        </tr>
      </table>
    </div>
  </body>
</html>