Sophie

Sophie

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

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>else</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="dust2.html" title="dust2" />
    <link rel="next" href="elseif.html" title="elseif" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">else</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="dust2.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="elseif.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="else">
      <a id="else"></a>
      <div class="titlepage"></div>
      <a id="IndexElse" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">else</span>
        </h2>
        <p>else — 
      Executes a block of code when an "if...then" condition is false.
          </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp19062240"></a>
        <h2>Description</h2>
        <p>
      Executes a block of code when an "if...then" condition is false.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp19062920"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">
          <span class="command">
            <strong>else</strong>
          </span>
        </pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp19092368"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>else</em></span> is used inside of a block of code between the <a class="link" href="if.html" title="if"><em class="citetitle">"if...then"</em></a> and <a class="link" href="endif.html" title="endif"><em class="citetitle">endif</em></a> opcodes. It defines which statements are executed when a "if...then" condition is false. Only one <span class="emphasis"><em>else</em></span> statement may occur and it must be the last conditional statement before the <span class="emphasis"><em>endif</em></span> opcode.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp19094824"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the else opcode. It uses the file <a class="ulink" href="examples/else.csd" target="_top"><em class="citetitle">else.csd</em></a>.
            </p>
        <div class="example">
          <a id="idp19095800"></a>
          <p class="title">
            <strong>Example 201. Example of the else 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 realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o else.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="oblock">instr</span> 1

ipch <span class="op">=</span> <span class="opc">cpspch</span>(p4)
ienv <span class="op">=</span> p5


<span class="octrl">if</span> (ienv <span class="op">==</span> 0) then 	
	kenv <span class="opc">adsr</span> 0.01, 0.95, .7, .5
<span class="octrl">else</span>
	kenv <span class="opc">linseg</span> 0, p3 <span class="op">*</span> .5, 1, p3 <span class="op">*</span> .5, 0
<span class="octrl">endif</span>

aout <span class="opc">vco2</span>    .8, ipch, 10
aout <span class="opc">moogvcf</span> aout, ipch <span class="op">+</span> (kenv <span class="op">*</span> 6 <span class="op">*</span> ipch) , .5

aout <span class="op">=</span> aout <span class="op">*</span> kenv
    <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 2 8.00 0
<span class="stamnt">i</span> 1 3 2 8.00 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="See Also">
        <a id="idp19098064"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="elseif.html" title="elseif"><em class="citetitle">elseif</em></a>,
      <a class="link" href="endif.html" title="endif"><em class="citetitle">endif</em></a>,
      <a class="link" href="goto.html" title="goto"><em class="citetitle">goto</em></a>,
      <a class="link" href="if.html" title="if"><em class="citetitle">if</em></a>,
      <a class="link" href="igoto.html" title="igoto"><em class="citetitle">igoto</em></a>,
      <a class="link" href="kgoto.html" title="kgoto"><em class="citetitle">kgoto</em></a>,
      <a class="link" href="tigoto.html" title="tigoto"><em class="citetitle">tigoto</em></a>,
      <a class="link" href="timout.html" title="timout"><em class="citetitle">timout</em></a>
    </p>
        <p> More information on this opcode: <a class="ulink" href="http://www.csounds.com/journal/2006spring/controlFlow.html" target="_top"><em class="citetitle">http://www.csounds.com/journal/2006spring/controlFlow.html</em></a>  , written by Steven Yi </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp19103200"></a>
        <h2>Credits</h2>
        <p>New in version 4.21</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="dust2.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="elseif.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">dust2 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> elseif</td>
        </tr>
      </table>
    </div>
  </body>
</html>