<?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_le</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_gt.html" title="loop_gt" /> <link rel="next" href="loop_lt.html" title="loop_lt" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">loop_le</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="loop_gt.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="loop_lt.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="loop_le"> <a id="loop_le"></a> <div class="titlepage"></div> <a id="Indexloop_le" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">loop_le</span> </h2> <p>loop_le — Looping constructions. </p> </div> <div class="refsect1" title="Description"> <a id="idp28903488"></a> <h2>Description</h2> <p> Construction of looping operations. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp28904136"></a> <h2>Syntax</h2> <pre class="synopsis"><span class="command"><strong>loop_le</strong></span> indx, incr, imax, label</pre> <pre class="synopsis"><span class="command"><strong>loop_le</strong></span> kndx, kncr, kmax, label</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp28915336"></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="idp28952616"></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_le</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"><=</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"><=</span> kmax) <span class="opc">kgoto</span> label</pre> <p> </p> </div> <div class="refsect1" title="Examples"> <a id="idp28959288"></a> <h2>Examples</h2> <p> Here is an example of the loop_le opcode. It uses the file <a class="ulink" href="examples/loop_le.csd" target="_top"><em class="citetitle">loop_le.csd</em></a>. </p> <div class="example"> <a id="idp28960264"></a> <p class="title"> <strong>Example 403. Example of the loop_le 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"><CsoundSynthesizer></span> <span class="csdtag"><CsOptions></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_le.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></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_le</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"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">i</span>1 0 10 <span class="stamnt">e</span> <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></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 play instance 5 </pre> <p> </p> </div> <div class="refsect1" title="See Also"> <a id="idp28963040"></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_lt.html" title="loop_lt"><em class="citetitle">loop_lt</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="idp28966328"></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_gt.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="loop_lt.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">loop_gt </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> loop_lt</td> </tr> </table> </div> </body> </html>