<?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>envlpx</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="endop.html" title="endop" /> <link rel="next" href="envlpxr.html" title="envlpxr" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">envlpx</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="endop.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="envlpxr.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="envlpx"> <a id="envlpx"></a> <div class="titlepage"></div> <a id="IndexEnvlpx" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">envlpx</span> </h2> <p>envlpx — Applies an envelope consisting of 3 segments. </p> </div> <div class="refsect1" title="Description"> <a id="idp19219016"></a> <h2>Description</h2> <p> <span class="emphasis"><em>envlpx</em></span> -- apply an envelope consisting of 3 segments: </p> <div class="orderedlist"> <ol class="orderedlist" type="1"> <li class="listitem"> <p>stored function rise shape</p> </li> <li class="listitem"> <p>modified exponential pseudo steady state</p> </li> <li class="listitem"> <p>exponential decay</p> </li> </ol> </div> <p> </p> </div> <div class="refsect1" title="Syntax"> <a id="idp19230904"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>envlpx</strong></span> xamp, irise, idur, idec, ifn, iatss, iatdec [, ixmod]</pre> <pre class="synopsis">kres <span class="command"><strong>envlpx</strong></span> kamp, irise, idur, idec, ifn, iatss, iatdec [, ixmod]</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp19232800"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>irise</em></span> -- rise time in seconds. A zero or negative value signifies no rise modification. </p> <p> <span class="emphasis"><em>idur</em></span> -- overall duration in seconds. A zero or negative value will cause initialization to be skipped. </p> <p> <span class="emphasis"><em>idec</em></span> -- decay time in seconds. Zero means no decay. An <span class="emphasis"><em>idec</em></span> > <span class="emphasis"><em>idur</em></span> will cause a truncated decay. </p> <p> <span class="emphasis"><em>ifn</em></span> -- function table number of stored rise shape with extended guard point. </p> <p> <span class="emphasis"><em>iatss</em></span> -- attenuation factor, by which the last value of the <span class="emphasis"><em>envlpx</em></span> rise is modified during the note's pseudo steady state. A factor greater than 1 causes an exponential growth and a factor less than 1 creates an exponential decay. A factor of 1 will maintain a true steady state at the last rise value. Note that this attenuation is not by fixed rate (as in a piano), but is sensitive to a note's duration. However, if <span class="emphasis"><em>iatss</em></span> is negative (or if steady state < 4 k-periods) a fixed attenuation rate of <span class="emphasis"><em>abs</em></span>(<span class="emphasis"><em>iatss</em></span>) per second will be used. 0 is illegal. </p> <p> <span class="emphasis"><em>iatdec</em></span> -- attenuation factor by which the closing steady state value is reduced exponentially over the decay period. This value must be positive and is normally of the order of .01. A large or excessively small value is apt to produce a cutoff which is audible. A zero or negative value is illegal. </p> <p> <span class="emphasis"><em>ixmod</em></span> (optional, between +- .9 or so) -- exponential curve modifier, influencing the steepness of the exponential trajectory during the steady state. Values less than zero will cause an accelerated growth or decay towards the target (e.g. <span class="emphasis"><em>subito piano</em></span>). Values greater than zero will cause a retarded growth or decay. The default value is zero (unmodified exponential). </p> </div> <div class="refsect1" title="Performance"> <a id="idp19293688"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kamp, xamp</em></span> -- input amplitude signal. </p> <p> Rise modifications are applied for the first <span class="emphasis"><em>irise</em></span> seconds, and decay from time <span class="emphasis"><em>idur - idec</em></span>. If these periods are separated in time there will be a steady state during which <span class="emphasis"><em>amp</em></span> will be modified by the first exponential pattern. If rise and decay periods overlap then both modifications will be in effect for that time. If the overall duration <span class="emphasis"><em>idur</em></span> is exceeded in performance, the final decay will continue on in the same direction, tending asymptotically to zero. </p> </div> <div class="refsect1" title="Examples"> <a id="idp19296104"></a> <h2>Examples</h2> <p> Here is an example of the envlpx opcode. It uses the file <a class="ulink" href="examples/envlpx.csd" target="_top"><em class="citetitle">envlpx.csd</em></a>. </p> <div class="example"> <a id="idp19297000"></a> <p class="title"> <strong>Example 206. Example of the envlpx 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 realtime audio input is needed too</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o envlpx.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="oblock">instr</span> 1 irise <span class="op">=</span> 0.2 idec <span class="op">=</span> 0.5 idur <span class="op">=</span> p3 <span class="op">-</span> idec ifn <span class="op">=</span> 1 iatss <span class="op">=</span> p5 iatdec <span class="op">=</span> 0.01 kenv <span class="opc">envlpx</span> .6, irise, idur, idec, ifn, iatss, iatdec kcps <span class="op">=</span> <span class="opc">cpspch</span>(p4) asig <span class="opc">vco2</span> kenv, kcps <span class="comment">;apply envlpx to the filter cut-off frequency</span> asig <span class="opc">moogvcf</span> asig, kcps <span class="op">+</span> (kenv <span class="op">*</span> 8 <span class="op">*</span> kcps) , .5 <span class="comment">;the higher the pitch, the higher the filter cut-off frequency</span> <span class="opc">outs</span> asig, asig <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="comment">; a linear rising envelope</span> <span class="stamnt">f</span> 1 0 129 -7 0 128 1 <span class="stamnt">i</span> 1 0 2 7.00 .1 <span class="stamnt">i</span> 1 + 2 7.02 1 <span class="stamnt">i</span> 1 + 2 7.03 2 <span class="stamnt">i</span> 1 + 2 7.05 3 <span class="stamnt">e</span> <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1" title="See Also"> <a id="idp19298888"></a> <h2>See Also</h2> <p> <a class="link" href="envlpxr.html" title="envlpxr"><em class="citetitle">envlpxr</em></a>, <a class="link" href="linen.html" title="linen"><em class="citetitle">linen</em></a>, <a class="link" href="linenr.html" title="linenr"><em class="citetitle">linenr</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="idp19300592"></a> <h2>Credits</h2> <p>Thanks goes to Luis Jure for pointing out a mistake with <span class="emphasis"><em>iatss</em></span>.</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="endop.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="envlpxr.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">endop </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> envlpxr</td> </tr> </table> </div> </body> </html>