Sophie

Sophie

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

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>tablefilter</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="tablecopy.html" title="tablecopy" />
    <link rel="next" href="tablefilteri.html" title="tablefilteri" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">tablefilter</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="tablecopy.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="tablefilteri.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="tablefilter">
      <a id="tablefilter"></a>
      <div class="titlepage"></div>
      <a id="IndexTablefilter" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">tablefilter</span>
        </h2>
        <p>tablefilter — 
      Filters a source table and writes result into a destination table.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp47302552"></a>
        <h2>Description</h2>
        <p>
      This opcode can be used in order to filter values from function
      tables following certain algorithms. The filtered output is
      written into a destination table and the number of elements that
      have passed the filter is returned.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp47303408"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">knumpassed <span class="command"><strong>tablefilter</strong></span> kouttable, kintatble, kmode, kparam</pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp47313928"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>knumpassed</em></span> -- the number of elements that
      have passed the filter.
    </p>
        <p>
      <span class="emphasis"><em>kouttable</em></span> -- the number of the table containing the values that have passed.
    </p>
        <p>
      <span class="emphasis"><em>kintatble</em></span> -- the number of the table used as filter input.
    </p>
        <p>
      <span class="emphasis"><em>kmode</em></span> -- mode of the filter:
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" type="disc">
            <li class="listitem">
          1 -- tests the weight of the denominators of the fractions
          in the source table.  Letting pass only values from the
          source that are less heavy than the weight of the threshold.
        </li>
            <li class="listitem">
          2 -- tests the weight of the denominators of the fractions
          in the source table.  Letting pass only values from the
          source that are heavier than or equal to the weight of the
          threshold.
        </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
      <span class="emphasis"><em>kparam</em></span> -- integer threshold parameter for
      the filter. It means that denominators whose weights are heavier
      than the weight of this threshold are not passed through the
      filter. The weight of an integer is calculated using Clarence
      Barlow's function of indigestibility of a number. According to
      this function, higher prime numbers contribute to an increased
      weight of any natural integer they divide.  The order of the
      first 16 integers according to their indigestibility is: 1, 2,
      4, 3, 8, 6, 16, 12, 9, 5, 10, 15, 7, 14.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp47350080"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the tablefilter opcode. It uses the file <a class="ulink" href="examples/tablefilter.csd" target="_top"><em class="citetitle">tablefilter.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp47351072"></a>
          <p class="title">
            <strong>Example 849. Example of the tablefilter 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="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>10
<span class="ohdr">nchnls</span><span class="op">=</span>1

      gifarn <span class="opc">init</span> 8     <span class="comment">; initialise integer for Farey Sequence F_8</span>
      gires <span class="opc">fareyleni</span> gifarn  <span class="comment">; calculate length of F_8, returns 23</span>
      <span class="comment">; the table length won't be a power of 2</span>
      <span class="comment">; (The length of a Farey Sequence with n &gt; 1 is always odd)</span>
      gilen <span class="opc">init</span> gires <span class="op">*</span> <span class="op">-</span>1

      gifarey <span class="ohdr">ftgen</span> 200, 0, gilen, "farey", gifarn, 0

      <span class="comment">; initialize destiniation table with 0s</span>
      gifiltered <span class="ohdr">ftgen</span> 0, 0, gilen, 21, 1, 0

      <span class="comment">; initialize second destiniation table with 0s</span>
      gifiltered2 <span class="ohdr">ftgen</span> 0, 0, gilen, 21, 1, 0

      <span class="comment">; table filtering opcode:   dest.         source,         mode,   threshold</span>
      ginumpassed <span class="opc">tablefilteri</span>    gifiltered,   gifarey,        1,      6
      <span class="comment">; the threshold parameter indicates that denominators whose weights are heavier</span>
      <span class="comment">; than 6 are not passing through the filter. The weight is calculated using</span>
      <span class="comment">; Clarence Barlow's function of indigestibility of a number. According to this function,</span>
      <span class="comment">; higher prime numbers contribute to an increased weight of any natural integer they divide.</span>
      <span class="comment">; ginumpassed is the number of elements from the source table 'gifarey'</span>
      <span class="comment">; that have passed the test and which have been copied to the destination table 'gifiltered'</span>

      <span class="comment">; apply a different filter:</span>
      ginumpassed2 <span class="opc">tablefilteri</span>   gifiltered2,  gifarey,        2,      5
      <span class="comment">; In mode=2 we again test the digestibility of the denominators of the</span>
      <span class="comment">; fractions in the source table.</span>
      <span class="comment">; The difference to mode=1 is that we now let pass only vaules from the</span>
      <span class="comment">; source that are as heavy as the threshold or greater.</span>


<span class="oblock">instr</span> 4
      kndx <span class="opc">init</span> 0 <span class="comment">; read out elements of now filtered F_8 sequentially and print to file</span>
      <span class="octrl">if</span> (kndx <span class="op">&lt;</span> ginumpassed) then
         kelem <span class="opc">tab</span> kndx, gifiltered
         <span class="opc">fprintks</span> "fareyfilter_lp.txt", "<span class="op">%</span>2.6f\\n", kelem
         kndx <span class="op">=</span> kndx<span class="op">+</span>1
      <span class="octrl">endif</span>
<span class="oblock">endin</span>

<span class="oblock">instr</span> 5
      kndx <span class="opc">init</span> 0 <span class="comment">; read out elements and print to file</span>
      <span class="octrl">if</span> (kndx <span class="op">&lt;</span> ginumpassed2) then
         kelem <span class="opc">tab</span> kndx, gifiltered2
         <span class="opc">fprintks</span> "fareyfilter_hp.txt", "<span class="op">%</span>2.6f\\n", kelem
         kndx <span class="op">=</span> kndx<span class="op">+</span>1
      <span class="octrl">endif</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>4      0     1
<span class="stamnt">i</span>5      0     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="idp47353352"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Georg Boenn </td>
          </tr>
          <tr>
            <td>University of Glamorgan, UK</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 5.13</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="tablecopy.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="tablefilteri.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">tablecopy </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> tablefilteri</td>
        </tr>
      </table>
    </div>
  </body>
</html>