<?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>transeg</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="tradsyn.html" title="tradsyn" /> <link rel="next" href="transegb.html" title="transegb" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">transeg</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="tradsyn.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="transegb.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="transeg"> <a id="transeg"></a> <div class="titlepage"></div> <a id="IndexTranseg" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">transeg</span> </h2> <p>transeg — Constructs a user-definable envelope. </p> </div> <div class="refsect1" title="Description"> <a id="idp49250600"></a> <h2>Description</h2> <p> Constructs a user-definable envelope. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp49251248"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>transeg</strong></span> ia, idur, itype, ib [, idur2] [, itype] [, ic] ...</pre> <pre class="synopsis">kres <span class="command"><strong>transeg</strong></span> ia, idur, itype, ib [, idur2] [, itype] [, ic] ...</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp49260280"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>ia</em></span> -- starting value. </p> <p> <span class="emphasis"><em>ib, ic,</em></span> etc. -- value after <span class="emphasis"><em>idur</em></span> seconds. </p> <p> <span class="emphasis"><em>idur</em></span> -- duration in seconds of first segment. A zero or negative value will cause all initialization to be skipped. </p> <p> <span class="emphasis"><em>idur2,... idurx</em></span> etc. -- duration in seconds of segment </p> <p> <span class="emphasis"><em>itype, itype2,</em></span> etc. -- if 0, a straight line is produced. If non-zero, then <span class="emphasis"><em>transeg</em></span> creates the following curve, for <span class="emphasis"><em>n</em></span> steps: </p> <div class="literallayout"> <p><br /> ibeg + (ivalue - ibeg) * (1 - exp( i*itype/(n-1) )) / (1 - exp(itype))<br /> </p> </div> <p> </p> </div> <div class="refsect1" title="Performance"> <a id="idp49264232"></a> <h2>Performance</h2> <p> If <span class="emphasis"><em>itype</em></span> > 0, there is a slowly rising (concave) or slowly decaying (convex) curve, while if <span class="emphasis"><em>itype</em></span> < 0, the curve is fast rising (convex) or fast decaying (concave). See also <a class="link" href="GEN16.html" title="GEN16"><em class="citetitle">GEN16</em></a>. </p> </div> <div class="refsect1" title="Examples"> <a id="idp49301896"></a> <h2>Examples</h2> <p> Here is an example of the transeg opcode. It uses the file <a class="ulink" href="examples/transeg.csd" target="_top"><em class="citetitle">transeg.csd</em></a>. The example produces the following output: </p> <div class="mediaobject"> <img src="images/transeg.png" alt="Output of the transeg example." /> <div class="caption"> <p>Output of the transeg example.</p> </div> </div> <p> </p> <div class="example"> <a id="idp49304536"></a> <p class="title"> <strong>Example 892. Example of the transeg 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> <span class="comment">; Audio out Audio in</span> -odac -iadc <span class="comment">;;;RT audio I/O</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o transeg.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> 128 <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 <span class="comment">;p4 and p5 determine the type of curve for each</span> <span class="comment">;section of the envelope</span> kenv <span class="opc">transeg</span> 0.01, p3<span class="op">*</span>0.25, p4, 1, p3<span class="op">*</span>0.75, p5, 0.01 a1 <span class="opc">oscil</span> kenv, 440, 1 <span class="opc">outs</span> a1, a1 <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="comment">; Table #1, a sine wave.</span> <span class="stamnt">f</span> 1 0 16384 10 1 <span class="stamnt">i</span> 1 0 2 2 2 <span class="stamnt">i</span> 1 + . 5 5 <span class="stamnt">i</span> 1 + . 1 1 <span class="stamnt">i</span> 1 + . 0 0 <span class="stamnt">i</span> 1 + . -2 -2 <span class="stamnt">i</span> 1 + . -2 2 <span class="stamnt">i</span> 1 + . 2 -2 <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="idp49306816"></a> <h2>See Also</h2> <p> <a class="link" href="expsega.html" title="expsega"><em class="citetitle">expsega</em></a>, <a class="link" href="expsegr.html" title="expsegr"><em class="citetitle">expsegr</em></a>, <a class="link" href="linseg.html" title="linseg"><em class="citetitle">linseg</em></a>, <a class="link" href="linsegr.html" title="linsegr"><em class="citetitle">linsegr</em></a>, <a class="link" href="transegr.html" title="transegr"><em class="citetitle">transegr</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="idp49309752"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: John ffitch</td> </tr> <tr> <td>University of Bath, Codemist. Ltd.</td> </tr> <tr> <td>Bath, UK</td> </tr> <tr> <td>October 2000</td> </tr> </table> <p> </p> <p>New in Csound version 4.09</p> <p>Thanks goes to Matt Gerassimoff for pointing out the correct command syntax.</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="tradsyn.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="transegb.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">tradsyn </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> transegb</td> </tr> </table> </div> </body> </html>