<?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>linen</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="line.html" title="line" /> <link rel="next" href="linenr.html" title="linenr" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">linen</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="line.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="linenr.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="linen"></a> <div class="titlepage"></div> <a id="IndexLinen" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">linen</span> </h2> <p>linen — Applies a straight line rise and decay pattern to an input amp signal. </p> </div> <div class="refsect1"> <a id="idm281472920923560"></a> <h2>Description</h2> <p> <span class="emphasis"><em>linen</em></span> -- apply a straight line rise and decay pattern to an input amp signal. </p> </div> <div class="refsect1"> <a id="idm281472920921864"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>linen</strong></span> xamp, irise, idur, idec</pre> <pre class="synopsis">kres <span class="command"><strong>linen</strong></span> kamp, irise, idur, idec</pre> </div> <div class="refsect1"> <a id="idm281472920849864"></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> </div> <div class="refsect1"> <a id="idm281472920845480"></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 unmodified. If <span class="emphasis"><em>linen</em></span> 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, going negative. </p> <p> </p> <div class="mediaobject"> <img src="images/linen.jpg" alt="[Envelope generated by the linen opcode]" /> <div class="caption"> <p>Envelope generated by the <span class="emphasis"><em>linen</em></span> opcode</p> </div> </div> <p> </p> <p> </p> <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Note]" src="images/note.png" /> </td> <th align="left">Note</th> </tr> <tr> <td align="left" valign="top"> <p>A common error with this opcode is to assume that the value of 0 is the held after the envelope has finished at <span class="emphasis"><em>idur</em></span>. <span class="emphasis"><em>linen</em></span> does not automatically end or stop at the end of the duration given. If your note length is longer than <span class="emphasis"><em>idur</em></span> seconds, <span class="emphasis"><em>kres</em></span> (or <span class="emphasis"><em>ares</em></span>) will not come to rest at 0, but will instead continue to fall with the same rate. If a decay and then hold is required then the <a class="link" href="linseg.html" title="linseg"><em class="citetitle">linseg</em></a> opcode should be considered instead. </p> </td> </tr> </table> </div> <p> </p> </div> <div class="refsect1"> <a id="idm281472920832296"></a> <h2>Examples</h2> <p> Here is an example of the linen opcode. It uses the file <a class="ulink" href="examples/linen.csd" target="_top"><em class="citetitle">linen.csd</em></a>. </p> <div class="example"> <a id="idm281472920830520"></a> <p class="title"> <strong>Example 458. Example of the linen 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="idm281472748201848"></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 linen.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> <span class="c1">; p4=amp</span> <span class="c1">; p5=freq</span> <span class="c1">; p6=attack time</span> <span class="c1">; p7=release time</span> a<span class="n">res</span> <span class="nb">linen</span> <span class="nb">p4</span><span class="p">,</span> <span class="nb">p6</span><span class="p">,</span> <span class="nb">p3</span><span class="p">,</span> <span class="nb">p7</span> a<span class="n">sig</span> <span class="nb">poscil</span> a<span class="n">res</span><span class="p">,</span> <span class="nb">p5</span><span class="p">,</span> <span class="mi">1</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="nb">f</span><span class="mi">1</span> <span class="mi">0</span> <span class="mi">4096</span> <span class="mi">10</span> <span class="mi">1</span> <span class="c1">; sine wave</span> <span class="c1">;ins strt dur amp freq attack release</span> <span class="nb">i</span><span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mf">.5</span> <span class="mi">440</span> <span class="mf">0.5</span> <span class="mf">0.7</span> <span class="nb">i</span><span class="mi">1</span> <span class="mf">1.5</span> <span class="mi">1</span> <span class="mf">.2</span> <span class="mi">440</span> <span class="mf">0.9</span> <span class="mf">0.1</span> <span class="nb">i</span><span class="mi">1</span> <span class="mi">3</span> <span class="mi">1</span> <span class="mf">.2</span> <span class="mi">880</span> <span class="mf">0.02</span> <span class="mf">0.99</span> <span class="nb">i</span><span class="mi">1</span> <span class="mf">4.5</span> <span class="mi">1</span> <span class="mf">.2</span> <span class="mi">880</span> <span class="mf">0.7</span> <span class="mf">0.01</span> <span class="nb">i</span><span class="mi">1</span> <span class="mi">6</span> <span class="mi">3</span> <span class="mf">.7</span> <span class="mi">220</span> <span class="mf">0.5</span> <span class="mf">0.5</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="idm281472920826232"></a> <h2>See Also</h2> <p> <a class="link" href="envlpx.html" title="envlpx"><em class="citetitle">envlpx</em></a>, <a class="link" href="envlpxr.html" title="envlpxr"><em class="citetitle">envlpxr</em></a>, <a class="link" href="linenr.html" title="linenr"><em class="citetitle">linenr</em></a> </p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="line.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="linenr.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">line </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> linenr</td> </tr> </table> </div> </body> </html>