<?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>exp</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="exitnow.html" title="exitnow" /> <link rel="next" href="expcurve.html" title="expcurve" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">exp</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="exitnow.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="expcurve.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="exp"> <a id="exp"></a> <div class="titlepage"></div> <a id="IndexExp" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">exp</span> </h2> <p>exp — Returns e raised to the x-th power. </p> </div> <div class="refsect1" title="Description"> <a id="idp19480104"></a> <h2>Description</h2> <p> Returns e raised to the <span class="emphasis"><em>x</em></span>th power. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp19480984"></a> <h2>Syntax</h2> <pre class="synopsis"><span class="command"><strong>exp</strong></span>(x) (no rate restriction)</pre> <p> where the argument within the parentheses may be an expression. Value converters perform arithmetic translation from units of one kind to units of another. The result can then be a term in a further expression. </p> </div> <div class="refsect1" title="Examples"> <a id="idp19501024"></a> <h2>Examples</h2> <p> Here is an example of the exp opcode. It uses the file <a class="ulink" href="examples/exp.csd" target="_top"><em class="citetitle">exp.csd</em></a>. </p> <div class="example"> <a id="idp19502000"></a> <p class="title"> <strong>Example 213. Example of the exp 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 exp.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 gisine <span class="ohdr">ftgen</span> 0, 0, 2^10, 10, 1 <span class="comment">;table for a sine wave</span> <span class="oblock">instr</span> 1 <span class="comment">;master instrument</span> koct <span class="opc">linseg</span> 6, p3, 12 <span class="comment">; octave register straight rising from 6 to 12</span> kexp <span class="opc">linseg</span> 0, p3<span class="op">/</span>3, 5, p3<span class="op">/</span>3, 5, p3<span class="op">/</span>3, 0 <span class="comment">;exponent goes from 0 to 5 and back</span> kdens <span class="op">=</span> <span class="opc">exp</span>(kexp) <span class="comment">;density is e to the power of kexp</span> <span class="opc">printks</span> "Generated events per second<span class="op">:</span> <span class="op">%</span>d\n", 1, kdens ktrig <span class="opc">metro</span> kdens <span class="comment">;trigger single notes in kdens frequency</span> <span class="octrl">if</span> ktrig <span class="op">==</span> 1 then <span class="comment">;call instr 10 for 1/kdens duration, .5 amplitude and koct register</span> <span class="opc">event</span> "i", 10, 0, 1<span class="op">/</span>kdens, .5, koct <span class="octrl">endif</span> <span class="oblock">endin</span> <span class="oblock">instr</span> 10 <span class="comment">;performs one tone</span> ioct <span class="opc">rnd31</span> 1, 0 <span class="comment">;random deviation maximum one octave plus/minus</span> aenv <span class="opc">transeg</span> p4, p3, <span class="op">-</span>6, 0 <span class="comment">;fast decaying envelope for p4 amplitude</span> asin <span class="opc">poscil</span> aenv, <span class="opc">cpsoct</span>(p5<span class="op">+</span>ioct), gisine <span class="comment">;sine for p5 octave register plus random deviation</span> <span class="opc">outs</span> asin, asin <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">i</span> 1 0 30 <span class="stamnt">e</span> <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> Its output should include lines like this: </p> <pre class="screen"> Generated events per second: 1 rtevent: T 0.000 TT 0.000 M: 0.00000 0.00000 new alloc for instr 10: rtevent: T 0.811 TT 0.811 M: 0.48906 0.48906 new alloc for instr 10: Generated events per second: 2 rtevent: T 1.387 TT 1.387 M: 0.48611 0.48611 rtevent: T 1.833 TT 1.833 M: 0.48421 0.48421 Generated events per second: 3 rtevent: T 2.198 TT 2.198 M: 0.47536 0.47536 rtevent: T 2.506 TT 2.506 M: 0.46530 0.46530 rtevent: T 2.773 TT 2.773 M: 0.44986 0.44986 Generated events per second: 4 rtevent: T 3.009 TT 3.009 M: 0.48096 0.48096 .........</pre> <p> </p> </div> <div class="refsect1" title="See Also"> <a id="idp19523752"></a> <h2>See Also</h2> <p> <a class="link" href="abs.html" title="abs"><em class="citetitle">abs</em></a>, <a class="link" href="frac.html" title="frac"><em class="citetitle">frac</em></a>, <a class="link" href="int.html" title="int"><em class="citetitle">int</em></a>, <a class="link" href="log.html" title="log"><em class="citetitle">log</em></a>, <a class="link" href="log10.html" title="log10"><em class="citetitle">log10</em></a>, <a class="link" href="opi.html" title="i"><em class="citetitle">i</em></a>, <a class="link" href="sqrt.html" title="sqrt"><em class="citetitle">sqrt</em></a> </p> </div> <div class="refsect1"> <a id="idp19526960"></a> <p>New in version 4.21</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="exitnow.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="expcurve.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">exitnow </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> expcurve</td> </tr> </table> </div> </body> </html>