Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 6ed14ebfd686aa32f7956e552aa2e21d > files > 746

csound-manual-5.13.0-5.fc15.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>endop</title>
    <link rel="stylesheet" href="csound.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.75.2" />
    <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="endin.html" title="endin" />
    <link rel="next" href="envlpx.html" title="envlpx" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">endop</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="endin.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="envlpx.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="endop">
      <a id="endop"></a>
      <div class="titlepage"></div>
      <a id="IndexEndop" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">endop</span>
        </h2>
        <p>endop — 
      Marks the end of an user-defined opcode block.
          </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="id2835821"></a>
        <h2>Description</h2>
        <p>
      Marks the end of an user-defined opcode block.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="id2835839"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">
          <span class="command">
            <strong>endop</strong>
          </span>
        </pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="id2835855"></a>
        <h2>Performance</h2>
        <p>
      The syntax of a user-defined opcode block is as follows:

      </p>
        <pre class="programlisting">
<span class="oblock">opcode</span>  <span class="command"><strong>name</strong></span>, outtypes, intypes
xinarg1 [, xinarg2] [, xinarg3] ... [xinargN]  <span class="opc">xin</span>
[<span class="opc">setksmps</span>  iksmps]
... the rest of the instrument's code.
<span class="opc">xout</span>  xoutarg1 [, xoutarg2] [, xoutarg3] ... [xoutargN]
<span class="oblock">endop</span></pre>
        <p>
    </p>
        <p>
      The new opcode can then be used with the usual syntax:

      </p>
        <pre class="programlisting">
[xinarg1] [, xinarg2] ... [xinargN]  <span class="command"><strong>name</strong></span>  [xoutarg1] [, xoutarg2] ... [xoutargN] [, iksmps]</pre>
        <p>
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="id2836808"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the endop opcode. It uses the file <a class="ulink" href="examples/endop.csd" target="_top"><em class="citetitle">endop.csd</em></a>.
            </p>
        <div class="example">
          <a id="id2836824"></a>
          <p class="title">
            <b>Example 185. Example of the endop opcode.</b>
          </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 endop.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="op">/</span><span class="op">*</span> example <span class="oblock">opcode</span> 1<span class="op">:</span> simple oscillator <span class="op">*</span><span class="op">/</span>

        <span class="oblock">opcode</span> Oscillator, a, kk

kamp, kcps      <span class="opc">xin</span>             <span class="comment">; read input parameters</span>
a1      <span class="opc">vco2</span> kamp, kcps         <span class="comment">; sawtooth oscillator</span>
        <span class="opc">xout</span> a1                 <span class="comment">; write output</span>

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

<span class="op">/</span><span class="op">*</span> example <span class="oblock">opcode</span> 2<span class="op">:</span> lowpass filter with local <span class="ohdr">ksmps</span> <span class="op">*</span><span class="op">/</span>

        <span class="oblock">opcode</span> Lowpass, a, akk

        <span class="opc">setksmps</span> 1              <span class="comment">; need sr=kr</span>
ain, ka1, ka2   <span class="opc">xin</span>             <span class="comment">; read input parameters</span>
aout    <span class="opc">init</span> 0                  <span class="comment">; initialize output</span>
aout    <span class="op">=</span>  ain<span class="op">*</span>ka1 <span class="op">+</span> aout<span class="op">*</span>ka2   <span class="comment">; simple tone-like filter</span>
        <span class="opc">xout</span> aout               <span class="comment">; write output</span>

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

<span class="op">/</span><span class="op">*</span> example <span class="oblock">opcode</span> 3<span class="op">:</span> recursive call <span class="op">*</span><span class="op">/</span>

        <span class="oblock">opcode</span> RecursiveLowpass, a, akkpp

ain, ka1, ka2, idep, icnt       <span class="opc">xin</span>     <span class="comment">; read input parameters</span>
        <span class="octrl">if</span> (icnt <span class="op">&gt;=</span> idep) <span class="octrl">goto</span> <span class="olabel">skip1</span>    <span class="comment">; check if max depth reached</span>
ain     RecursiveLowpass ain, ka1, ka2, idep, icnt <span class="op">+</span> 1
<span class="olabel">skip1</span><span class="op">:</span>
aout    Lowpass ain, ka1, ka2           <span class="comment">; call filter</span>
        <span class="opc">xout</span> aout                       <span class="comment">; write output</span>

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

<span class="op">/</span><span class="op">*</span> example <span class="oblock">opcode</span> 4<span class="op">:</span> de<span class="op">-</span>click envelope <span class="op">*</span><span class="op">/</span>

        <span class="oblock">opcode</span> DeClick, a, <span class="opc">a</span>

ain     <span class="opc">xin</span>
aenv    <span class="opc">linseg</span> 0, 0.02, 1, p3 <span class="op">-</span> 0.05, 1, 0.02, 0, 0.01, 0
        <span class="opc">xout</span> ain <span class="op">*</span> aenv         <span class="comment">; apply envelope and write output</span>

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

<span class="op">/</span><span class="op">*</span> <span class="oblock">instr</span> 1 uses the example opcodes <span class="op">*</span><span class="op">/</span>

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

kamp    <span class="op">=</span>  .6                <span class="comment">; amplitude</span>
kcps    <span class="opc">expon</span> 50, p3, 500       <span class="comment">; pitch</span>
a1      Oscillator kamp, kcps                   <span class="comment">; call oscillator</span>
kflt    <span class="opc">linseg</span> 0.4, 1.5, 0.4, 1, 0.8, 1.5, 0.8  <span class="comment">; filter envelope</span>
a1      RecursiveLowpass a1, kflt, 1 <span class="op">-</span> kflt, 10 <span class="comment">; 10th order lowpass</span>
a1      DeClick a1
        <span class="opc">outs</span> a1, a1

<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 4
<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="id2836862"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="opcode.html" title="opcode"><em class="citetitle">opcode</em></a>, 
      <a class="link" href="setksmps.html" title="setksmps"><em class="citetitle">setksmps</em></a>, 
      <a class="link" href="xin.html" title="xin"><em class="citetitle">xin</em></a>, 
      <a class="link" href="xout.html" title="xout"><em class="citetitle">xout</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 </p>
        <p> The user-defined opcode page: <a class="ulink" href="http://www.csounds.com/udo/" target="_top"><em class="citetitle">http://www.csounds.com/udo/</em></a>  , maintained by Steven Yi </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="id2836928"></a>
        <h2>Credits</h2>
        <p>Author: Istvan Varga, 2002; based on code by Matt J. Ingalls</p>
        <p>New in version 4.22</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="endin.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="envlpx.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">endin </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> envlpx</td>
        </tr>
      </table>
    </div>
  </body>
</html>