<?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" /> <link rel="stylesheet" type="text/css" href="syntax-highlighting.css" /> <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /> <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"> <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"> <a id="idm281472939726232"></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"> <a id="idm281472939655784"></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"> <a id="idm281472939652040"></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"> <a id="idm281472939639480"></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 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"> <a id="idm281472939634184"></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="idm281472939632408"></a> <p class="title"> <strong>Example 242. 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> <div class="refsect1"> <a id="idm281472771928648"></a> <pre class="programlisting"> <span class="nt"><CsoundSynthesizer></span> <span class="nt"><CsOptions></span> <span class="c1">; Select audio/midi flags here according to platform</span> -odac <span class="c1">;;;realtime audio out</span> <span class="c1">;-iadc ;;;uncomment -iadc if realtime audio input is needed too</span> <span class="c1">; For Non-realtime ouput leave only the line below:</span> <span class="c1">; -o envlpx.wav -W ;;; for file output any platform</span> <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></span> <span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span> <span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">32</span> <span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">2</span> <span class="vg">0dbfs</span> <span class="o">=</span> <span class="mi">1</span> <span class="kd">instr</span> <span class="nf">1</span> i<span class="n">rise</span> <span class="o">=</span> <span class="mf">0.2</span> i<span class="n">dec</span> <span class="o">=</span> <span class="mf">0.5</span> i<span class="n">dur</span> <span class="o">=</span> <span class="nb">p3</span> <span class="o">-</span> i<span class="n">dec</span> i<span class="n">fn</span> <span class="o">=</span> <span class="mi">1</span> i<span class="n">atss</span> <span class="o">=</span> <span class="nb">p5</span> i<span class="n">atdec</span> <span class="o">=</span> <span class="mf">0.01</span> k<span class="n">env</span> <span class="nb">envlpx</span> <span class="mf">.6</span><span class="p">,</span> i<span class="n">rise</span><span class="p">,</span> i<span class="n">dur</span><span class="p">,</span> i<span class="n">dec</span><span class="p">,</span> i<span class="n">fn</span><span class="p">,</span> i<span class="n">atss</span><span class="p">,</span> i<span class="n">atdec</span> k<span class="n">cps</span> <span class="o">=</span> <span class="nb">cpspch</span><span class="p">(</span><span class="nb">p4</span><span class="p">)</span> a<span class="n">sig</span> <span class="nb">vco2</span> k<span class="n">env</span><span class="p">,</span> k<span class="n">cps</span> <span class="c1">;apply envlpx to the filter cut-off frequency</span> a<span class="n">sig</span> <span class="nb">moogvcf</span> a<span class="n">sig</span><span class="p">,</span> k<span class="n">cps</span> <span class="o">+</span> <span class="p">(</span>k<span class="n">env</span> <span class="o">*</span> <span class="mi">8</span> <span class="o">*</span> k<span class="n">cps</span><span class="p">)</span> <span class="p">,</span> <span class="mf">.5</span> <span class="c1">;the higher the pitch, the higher the filter cut-off frequency</span> <span class="nb">outs</span> a<span class="n">sig</span><span class="p">,</span> a<span class="n">sig</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></span> <span class="c1">; a linear rising envelope</span> <span class="nb">f</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">129</span> <span class="o">-</span><span class="mi">7</span> <span class="mi">0</span> <span class="mi">128</span> <span class="mi">1</span> <span class="nb">i</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mf">7.00</span> <span class="mf">.1</span> <span class="nb">i</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">2</span> <span class="mf">7.02</span> <span class="mi">1</span> <span class="nb">i</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">2</span> <span class="mf">7.03</span> <span class="mi">2</span> <span class="nb">i</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">2</span> <span class="mf">7.05</span> <span class="mi">3</span> <span class="nb">e</span> <span class="nt"></CsScore></span> <span class="nt"></CsoundSynthesizer></span> </pre> </div> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1"> <a id="idm281472939628280"></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"> <a id="idm281472939624248"></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>