Sophie

Sophie

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

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>table</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="tabrec.html" title="tabrec" />
    <link rel="next" href="table3.html" title="table3" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">table</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="tabrec.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="table3.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="table">
      <a id="table"></a>
      <div class="titlepage"></div>
      <a id="IndexTable" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">table</span>
        </h2>
        <p>table — 
      Accesses table values by direct indexing.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp47200624"></a>
        <h2>Description</h2>
        <p>
      Accesses table values by direct indexing.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp47242744"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>table</strong></span> andx, ifn [, ixmode] [, ixoff] [, iwrap]</pre>
        <pre class="synopsis">ires <span class="command"><strong>table</strong></span> indx, ifn [, ixmode] [, ixoff] [, iwrap]</pre>
        <pre class="synopsis">kres <span class="command"><strong>table</strong></span> kndx, ifn [, ixmode] [, ixoff] [, iwrap]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp47245304"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifn</em></span> -- function table number.
    </p>
        <p>
      <span class="emphasis"><em>ixmode</em></span> (optional) -- index data mode. The default value is 0.
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" type="disc">
            <li class="listitem">
              <p>0 = raw index</p>
            </li>
            <li class="listitem">
              <p>1 = normalized (0 to 1)</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
      <span class="emphasis"><em>ixoff</em></span> (optional) -- amount by which index is to be offset. For a table with origin at center, use tablesize/2 (raw) or .5 (normalized). The default value is 0.
    </p>
        <p>
      <span class="emphasis"><em>iwrap</em></span> (optional) -- wraparound index flag. The default value is 0.
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" type="disc">
            <li class="listitem">
              <p>0 = nowrap (index &lt; 0 treated as index=0; index &gt; tablesize sticks at index=size)</p>
            </li>
            <li class="listitem">
              <p>1 = wraparound.</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp47249544"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>table</em></span> invokes table lookup on behalf of init, control or audio indices. These indices can be raw entry numbers (0,l,2...size - 1) or scaled values (0 to 1-e). Indices are first modified by the offset value then checked for range before table lookup (see <span class="emphasis"><em>iwrap</em></span>). If index is likely to be full scale, or if interpolation is being used, the table should have an extended guard point. <span class="emphasis"><em>table</em></span> indexed by a periodic phasor ( see <a class="link" href="phasor.html" title="phasor"><em class="citetitle">phasor</em></a>) will simulate an oscillator.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp47251696"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the table opcode. It uses the file <a class="ulink" href="examples/table.csd" target="_top"><em class="citetitle">table.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp47252664"></a>
          <p class="title">
            <strong>Example 847. Example of the table 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 table.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="comment">; Instrument #1.</span>
<span class="oblock">instr</span> 1
  <span class="comment">; Vary our index linearly from 0 to 1.</span>
  kndx <span class="opc">line</span> 0, p3, 1

  <span class="comment">; Read Table #1 with our index.</span>
  ifn <span class="op">=</span> 1
  ixmode <span class="op">=</span> 1
  kfreq <span class="opc">table</span> kndx, ifn, ixmode

  <span class="comment">; Generate a sine waveform, use our table values </span>
  <span class="comment">; to vary its frequency.</span>
  a1 <span class="opc">oscil</span> 20000, kfreq, 2
  <span class="opc">out</span> a1
<span class="oblock">endin</span>


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

<span class="comment">; Table #1, a line from 200 to 2,000.</span>
<span class="stamnt">f</span> 1 0 1025 -7 200 1024 2000
<span class="comment">; Table #2, a sine wave.</span>
<span class="stamnt">f</span> 2 0 16384 10 1

<span class="comment">; Play Instrument #1 for 2 seconds.</span>
<span class="stamnt">i</span> 1 0 2
<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="idp47254936"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="tablei.html" title="tablei"><em class="citetitle">tablei</em></a>, 
      <a class="link" href="table3.html" title="table3"><em class="citetitle">table3</em></a>, 
      <a class="link" href="oscil1.html" title="oscil1"><em class="citetitle">oscil1</em></a>, 
      <a class="link" href="oscil1i.html" title="oscil1i"><em class="citetitle">oscil1i</em></a>, 
      <a class="link" href="osciln.html" title="osciln"><em class="citetitle">osciln</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp47257872"></a>
        <h2>Credits</h2>
        <p>Example written by Kevin Conder.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="tabrec.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="table3.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">tabrec </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> table3</td>
        </tr>
      </table>
    </div>
  </body>
</html>