<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="release">
  <refmeta>
    <refentrytitle>release</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>release</refname>

    <refpurpose>
      Indicates whether a note is in its <quote>release</quote> stage.
      <indexterm id="IndexRelease"><primary>release</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Indicates whether a note is in its <quote>release</quote> stage.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>kflag <command>release</command></synopsis>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>kflag</emphasis> -- indicates whether the note is in its <quote>release</quote> stage.
    </para>

    <para>
      <emphasis>release</emphasis> outputs current note state. If current note is in the <quote>release</quote> stage (i.e. if its duration has been extended with <link linkend="xtratim"><citetitle>xtratim</citetitle></link> opcode and if it has only just deactivated), then the <emphasis>kflag</emphasis> output argument is set to 1. Otherwise (in sustain stage of current note), <emphasis>kflag</emphasis> is set to 0. 
    </para>

    <para>
       This opcode is useful for implementing complex release-oriented envelopes.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      <informalexample>
        <programlisting>
 <emphasis>instr</emphasis> 1 ;allows complex ADSR envelope with MIDI events
  inum <emphasis>notnum</emphasis>
  icps <emphasis>cpsmidi</emphasis>
  iamp <emphasis>ampmid</emphasis>i 4000
 ;
 ;------- complex envelope block ------
  <emphasis>xtratim</emphasis> 1 ;extra-time, i.e. release dur
  krel <emphasis>init</emphasis> 0
  krel <emphasis>release</emphasis> ;outputs release-stage flag (0 or 1 values)
  if (krel  .5) <emphasis>kgoto</emphasis> rel ;if in release-stage goto release section
 ;
 ;************ attack and sustain section ***********
  kmp1 <emphasis>linseg</emphasis> 0, .03, 1, .05, 1, .07, 0, .08, .5, 4, 1, 50, 1
  kmp = kmp1*iamp
   <emphasis>kgoto</emphasis> done
 ;
 ;--------- release section --------
   rel:
  kmp2 <emphasis>linseg</emphasis> 1, .3, .2, .7, 0
  kmp = kmp1*kmp2*iamp
  done:
 ;------
  a1 <emphasis>oscili</emphasis> kmp, icps, 1
  <emphasis>out</emphasis> a1
 <emphasis>endin</emphasis>
        </programlisting>
      </informalexample>
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="xtratim"><citetitle>xtratim</citetitle></link>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: &namegabriel;</member>
        <member>Italy</member>
      </simplelist>
    </para>

    <para>New in Csound version 3.47</para>
  </refsect1>
</refentry>
