<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="xadsr">
  <refmeta>
    <refentrytitle>xadsr</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>xadsr</refname>
    <refpurpose>
      Calculates the classical ADSR envelope.
      <indexterm id="IndexXadsr"><primary>xadsr</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Calculates the classical ADSR envelope
   </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>ar <command>xadsr</command> iatt, idec, islev, irel [, idel]</synopsis>

    <synopsis>kr <command>xadsr</command> iatt, idec, islev, irel [, idel]</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>iatt</emphasis> -- duration of attack phase
    </para>

    <para>
      <emphasis>idec</emphasis> -- duration of decay
    </para>

    <para>
      <emphasis>islev</emphasis> -- level for sustain phase
    </para>

    <para>
      <emphasis>irel</emphasis> -- duration of release phase
    </para>

    <para>
      <emphasis>idel</emphasis> -- period of zero before the envelope starts
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      The envelope is the range 0 to 1 and may need to be scaled further. The envelope may be described as:
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/adsr.png" format="PNG">
        </imageobject>

        <textobject>
          <phrase>Picture of an ADSR envelope.</phrase>
        </textobject>
        
        <caption>
          <para>Picture of an ADSR envelope.</para>
        </caption>
      </mediaobject>
    </para>

    <para>
       The length of the sustain is calculated from the length of the note. This means <link linkend="adsr"><citetitle>adsr</citetitle></link> is not suitable for use with MIDI events. The opcode <emphasis>xadsr</emphasis> is identical to <emphasis>adsr</emphasis> except it uses exponential, rather than linear, line segments.
    </para>

    <para>
      <emphasis>xadsr</emphasis> is new in Csound version 3.51.
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="adsr"><citetitle>adsr</citetitle></link>,
      <link linkend="madsr"><citetitle>madsr</citetitle></link>,
      <link linkend="mxadsr"><citetitle>mxadsr</citetitle></link>
    </para>
  </refsect1>
</refentry>
