Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 5fcfcb7517038d1f44ab4e478e6e61fa > files > 360

csound-doc-6.10.0-1.mga7.noarch.rpm

<?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>adsr</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="active.html" title="active" />
    <link rel="next" href="adsyn.html" title="adsyn" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">adsr</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="active.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="adsyn.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="adsr"></a>
      <div class="titlepage"></div>
      <a id="IndexAdsr" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">adsr</span>
        </h2>
        <p>adsr — 
      Calculates the classical ADSR envelope using linear segments.
          </p>
      </div>
      <div class="refsect1">
        <a id="idm281472952071672"></a>
        <h2>Description</h2>
        <p>
      Calculates the classical ADSR envelope using linear segments.
   </p>
      </div>
      <div class="refsect1">
        <a id="idm281472952028568"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>adsr</strong></span> iatt, idec, islev, irel [, idel]</pre>
        <pre class="synopsis">kres <span class="command"><strong>adsr</strong></span> iatt, idec, islev, irel [, idel]</pre>
      </div>
      <div class="refsect1">
        <a id="idm281472952024856"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>iatt</em></span> -- duration of attack phase
    </p>
        <p>
      <span class="emphasis"><em>idec</em></span> -- duration of decay
    </p>
        <p>
      <span class="emphasis"><em>islev</em></span> -- level for sustain phase
    </p>
        <p>
      <span class="emphasis"><em>irel</em></span> -- duration of release phase
    </p>
        <p>
      <span class="emphasis"><em>idel</em></span> -- period of zero before the envelope starts
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472952019480"></a>
        <h2>Performance</h2>
        <p>
      The envelope generated is the range 0 to 1 and may need to be scaled 
      further, depending on the amplitude required. If using 
      <a class="link" href="Zerodbfs.html" title="0dbfs"><em class="citetitle">0dbfs</em></a> = 1, scaling down
      will probably be required since playing more than one note might result in clipping.
      If not using <a class="link" href="Zerodbfs.html" title="0dbfs"><em class="citetitle">0dbfs</em></a>, scaling
       to a large amplitude (e.g. 32000) might be required.
      </p>
        <p>
      The envelope may be described as:
      </p>
        <div class="mediaobject">
          <img src="images/adsr.png" alt="Picture of an ADSR envelope." />
          <div class="caption">
            <p>Picture of an ADSR envelope.</p>
          </div>
        </div>
        <p>
    </p>
        <p>
       The length of the sustain is calculated from the length of the note. This means <span class="emphasis"><em>adsr</em></span> is not suitable for use with MIDI events. The opcode <a class="link" href="madsr.html" title="madsr"><em class="citetitle">madsr</em></a> uses the <a class="link" href="linsegr.html" title="linsegr"><em class="citetitle">linsegr</em></a> mechanism, and so can be used in MIDI applications.
    </p>
        <p>
      <span class="emphasis"><em>adsr</em></span> is new in Csound version 3.49.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472952008408"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the adsr opcode. It uses the file <a class="ulink" href="examples/adsr.csd" target="_top"><em class="citetitle">adsr.csd</em></a>.

      </p>
        <div class="example">
          <a id="idm281472952006632"></a>
          <p class="title">
            <strong>Example 45. Example of the adsr 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="idm281472787594312"></a>
              <pre class="programlisting">
<span class="nt">&lt;CsoundSynthesizer&gt;</span>
<span class="nt">&lt;CsOptions&gt;</span>
<span class="c1">; Select audio/midi flags here according to platform</span>
-odac     <span class="c1">;;;RT audio out</span>
<span class="c1">;-iadc    ;;;uncomment -iadc if RT audio input is needed too</span>
<span class="c1">; For Non-realtime ouput leave only the line below:</span>
<span class="c1">; -o adsr.wav -W ;;; for file output any platform</span>
<span class="nt">&lt;/CsOptions&gt;</span>
<span class="nt">&lt;CsInstruments&gt;</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">att</span>  <span class="o">=</span> <span class="nb">p5</span>
i<span class="n">dec</span>  <span class="o">=</span> <span class="nb">p6</span>  
i<span class="n">slev</span> <span class="o">=</span> <span class="nb">p7</span>
i<span class="n">rel</span>  <span class="o">=</span> <span class="nb">p8</span>

k<span class="n">env</span>	<span class="nb">adsr</span> i<span class="n">att</span><span class="p">,</span> i<span class="n">dec</span><span class="p">,</span> i<span class="n">slev</span><span class="p">,</span> i<span class="n">rel</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> 	  <span class="c1">;frequency</span>

a<span class="n">sig</span>	<span class="nb">vco2</span>  k<span class="n">env</span> <span class="o">*</span> <span class="mf">0.8</span><span class="p">,</span> k<span class="n">cps</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">&lt;/CsInstruments&gt;</span>
<span class="nt">&lt;CsScore&gt;</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">.0001</span>  <span class="mi">1</span>  <span class="mf">.5</span>  <span class="mf">.001</span> <span class="c1">; short attack</span>
<span class="nb">i</span> <span class="mi">1</span>  <span class="mi">3</span>  <span class="mi">2</span>  <span class="mf">7.02</span>  <span class="mi">1</span>  <span class="mf">.5</span>  <span class="mf">.5</span>  <span class="mf">.001</span>    <span class="c1">; long attack</span>
<span class="nb">i</span> <span class="mi">1</span>  <span class="mi">6</span>  <span class="mi">2</span>  <span class="mf">6.09</span>  <span class="mf">.0001</span>  <span class="mi">1</span> <span class="mf">.5</span>  <span class="mf">.7</span>     <span class="c1">; long release</span>

<span class="nb">e</span>

<span class="nt">&lt;/CsScore&gt;</span>
<span class="nt">&lt;/CsoundSynthesizer&gt;</span>
</pre>
            </div>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472952002312"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="madsr.html" title="madsr"><em class="citetitle">madsr</em></a>,
      <a class="link" href="mxadsr.html" title="mxadsr"><em class="citetitle">mxadsr</em></a>,
      <a class="link" href="xadsr.html" title="xadsr"><em class="citetitle">xadsr</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472951998280"></a>
        <h2>Credits</h2>
        <p>Author: John ffitch</p>
        <p>New in version 3.49</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="active.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="adsyn.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">active </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> adsyn</td>
        </tr>
      </table>
    </div>
  </body>
</html>