Sophie

Sophie

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

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>loop_lt</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="loop_le.html" title="loop_le" />
    <link rel="next" href="loopseg.html" title="loopseg" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">loop_lt</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="loop_le.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="loopseg.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="loop_lt">
      <a id="loop_lt"></a>
      <div class="titlepage"></div>
      <a id="IndexLoop" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">loop_lt</span>
        </h2>
        <p>loop_lt — 
      Looping constructions.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp28943320"></a>
        <h2>Description</h2>
        <p>
      Construction of looping operations.
   </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp28992088"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>loop_lt</strong></span>  indx, incr, imax, label</pre>
        <pre class="synopsis"><span class="command"><strong>loop_lt</strong></span>  kndx, kncr, kmax, label</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp28993744"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>indx</em></span> -- i-rate variable to count loop.
    </p>
        <p>
      <span class="emphasis"><em>incr</em></span> -- value to increment the loop.
    </p>
        <p>
      <span class="emphasis"><em>imax</em></span> -- maximum value of loop index.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp28995496"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kndx</em></span> -- k-rate variable to count loop.
    </p>
        <p>
      <span class="emphasis"><em>kncr</em></span> -- value to increment the loop.
    </p>
        <p>
      <span class="emphasis"><em>kmax</em></span> -- maximum value of loop index.
    </p>
        <p>
      The actions of <span class="command"><strong>loop_lt</strong></span> are equivalent to the
      code
       </p>
        <pre class="programlisting">
         indx  <span class="op">=</span>  indx <span class="op">+</span> incr
         <span class="opc">if</span> (indx <span class="op">&lt;</span> imax) <span class="opc">igoto</span> label</pre>
        <p>
  or
       </p>
        <pre class="programlisting">
         kndx  <span class="op">=</span>  kndx <span class="op">+</span> kncr
         <span class="opc">if</span> (kndx <span class="op">&lt;</span> kmax) <span class="opc">kgoto</span> label</pre>
        <p>
    </p>
        <div class="refsect1" title="Examples">
          <a id="idp29002168"></a>
          <h2>Examples</h2>
          <p>
      Here is an example of the loop_lt opcode. It uses the file <a class="ulink" href="examples/loop_lt.csd" target="_top"><em class="citetitle">loop_lt.csd</em></a>.
      </p>
          <div class="example">
            <a id="idp29003144"></a>
            <p class="title">
              <strong>Example 404. Example of the loop_lt 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>
-odac     <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if RT audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o loop_lt.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="ohdr">seed</span> 0
gisine <span class="ohdr">ftgen</span> 0, 0, 2^10, 10, 1

<span class="oblock">instr</span> 1 <span class="comment">;master instrument</span>

ininstr <span class="op">=</span> 5 <span class="comment">;number of called instances</span>
indx <span class="op">=</span> 0
<span class="olabel">loop</span><span class="op">:</span>
      <span class="opc">prints</span> "play instance <span class="op">%</span>d\\n", indx
ipan  <span class="opc">random</span> 0, 1
ifreq <span class="opc">random</span> 100, 1000
iamp  <span class="op">=</span> 1<span class="op">/</span>ininstr
<span class="opc">event_i</span> "i", 10, 0, p3, iamp, ifreq, ipan
<span class="octrl">loop_lt</span> indx, 1, ininstr, <span class="olabel">loop</span>

<span class="oblock">endin</span>

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

ipeak <span class="opc">random</span> 0, 1 <span class="comment">;where is the envelope peak</span>
asig  <span class="opc">poscil3</span> p4, p5, gisine
aenv  <span class="opc">transeg</span> 0, p3<span class="op">*</span>ipeak, 6, 1, p3<span class="op">-</span>p3<span class="op">*</span>ipeak, <span class="op">-</span>6, 0
aL,aR <span class="opc">pan2</span> asig<span class="op">*</span>aenv, p6
      <span class="opc">outs</span> aL, aR

<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 10
<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" />
            Its output should include a line like this:
      </p>
          <pre class="screen">
play instance 0
play instance 1
play instance 2
play instance 3
play instance 4
      </pre>
          <p>
    </p>
        </div>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp29005968"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="loop_ge.html" title="loop_ge"><em class="citetitle">loop_ge</em></a>,
      <a class="link" href="loop_gt.html" title="loop_gt"><em class="citetitle">loop_gt</em></a> and
      <a class="link" href="loop_le.html" title="loop_le"><em class="citetitle">loop_le</em></a>.
    </p>
        <p> More information on this opcode: <a class="ulink" href="http://www.csounds.com/journal/2006summer/controlFlow_part2.html" target="_top"><em class="citetitle">http://www.csounds.com/journal/2006summer/controlFlow_part2.html</em></a>  , written by Steven Yi. 
 And in the Floss Manuals: <a class="ulink" href="http://en.flossmanuals.net/csound/ch018_c-control-structures" target="_top"><em class="citetitle"> http://en.flossmanuals.net/csound/ch018_c-control-structures</em></a></p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp29009280"></a>
        <h2>Credits</h2>
        <p>Istvan Varga.</p>
        <p>New in Csound version 5.01</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="loop_le.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="loopseg.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">loop_le </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> loopseg</td>
        </tr>
      </table>
    </div>
  </body>
</html>