Sophie

Sophie

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

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>vaget</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="vaddv_i.html" title="vaddv_i" />
    <link rel="next" href="valpass.html" title="valpass" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">vaget</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="vaddv_i.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="valpass.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="vaget">
      <a id="vaget"></a>
      <div class="titlepage"></div>
      <a id="IndexAvarGet" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">vaget</span>
        </h2>
        <p>vaget — 
      Access values of the current buffer of an a-rate variable by indexing.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp50131864"></a>
        <h2>Description</h2>
        <p>
      Access values of the current buffer of an a-rate variable by indexing.
      Useful for doing sample-by-sample manipulation at k-rate without using
      setksmps 1.

      </p>
        <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note: 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>Because this opcode does not do any bounds checking, the user
        must be careful not to try to read values past ksmps (the
        size of a buffer for an a-rate variable) by using index values greater
        than ksmps.</p>
              </td>
            </tr>
          </table>
        </div>
        <p>
      </p>
        <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note: 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>In Csound6 this opcode does do bounds checking.</p>
              </td>
            </tr>
          </table>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp50120312"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">kval <span class="command"><strong>vaget</strong></span> kndx, avar</pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp50171984"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kval</em></span> - value read from avar
    </p>
        <p>
      <span class="emphasis"><em>kndx</em></span> - index of the sample to read from the current
      buffer of the given avar variable
    </p>
        <p>
      <span class="emphasis"><em>avar</em></span> - a-rate variable to read from
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp50173688"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the vaget opcode. It uses the file <a class="ulink" href="examples/vaget.csd" target="_top"><em class="citetitle">vaget.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp50174656"></a>
          <p class="title">
            <strong>Example 916. Example of the vaget 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    No messages</span>
-odac           -iadc     -d     <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 avarget.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>16
<span class="ohdr">nchnls</span><span class="op">=</span>2

	<span class="oblock">instr</span> 1	<span class="comment">; Sqrt Signal</span>
ifreq <span class="op">=</span> (p4 <span class="op">&gt;</span> 15 <span class="op">?</span> p4 <span class="op">:</span> <span class="opc">cpspch</span>(p4))
iamp <span class="op">=</span> <span class="opc">ampdb</span>(p5)

aout <span class="opc">init</span> 0
ksampnum <span class="opc">init</span> 0

kenv	<span class="opc">linseg</span> 0, p3 <span class="op">*</span> .5, 1, p3 <span class="op">*</span> .5, 0

aout1	<span class="opc">vco2</span>	1, ifreq
aout2	<span class="opc">vco2</span>	.5, ifreq <span class="op">*</span> 2
aout3	<span class="opc">vco2</span>	.2, ifreq <span class="op">*</span> 4

aout	<span class="opc">sum</span> 	aout1, aout2, aout3

<span class="comment">;Take Sqrt of signal, checking for negatives</span>
kcount <span class="op">=</span> 0

<span class="olabel">loopStart</span><span class="op">:</span>

	kval <span class="opc">vaget</span> kcount,aout

	<span class="octrl">if</span> (kval <span class="op">&gt;</span> .0) then
		kval <span class="op">=</span> <span class="opc">sqrt</span>(kval)
	<span class="octrl">elseif</span> (kval <span class="op">&lt;</span> 0) then
		kval <span class="op">=</span> <span class="opc">sqrt</span>(<span class="op">-</span>kval) <span class="op">*</span> <span class="op">-</span>1
	<span class="octrl">else</span>
		kval <span class="op">=</span> 0
	<span class="octrl">endif</span>

	<span class="opc">vaset</span> kval, kcount,aout

<span class="octrl">loop_lt</span> kcount, 1, ksmps, <span class="olabel">loopStart</span>

aout <span class="op">=</span> aout <span class="op">*</span> kenv

aout	<span class="opc">moogladder</span> aout, 8000, .1

aout <span class="op">=</span> aout <span class="op">*</span> iamp

<span class="opc">outs</span> aout, aout
	<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.0	2 440 80
<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="idp50176928"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="vaset.html" title="vaset"><em class="citetitle">vaset</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp50177944"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Steven Yi</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in version 5.04</p>
        <p>September 2006.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="vaddv_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="valpass.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">vaddv_i </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> valpass</td>
        </tr>
      </table>
    </div>
  </body>
</html>