<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="GEN05">
  <refmeta>
    <refentrytitle>GEN05</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>GEN05</refname>
    <refpurpose>
      Constructs functions from segments of exponential curves.
      <indexterm id="IndexGEN05"><primary>GEN05</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Constructs functions from segments of exponential curves.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>f</command> # time size 5 a n1 b n2 c ...</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>size </emphasis> -- number of points in the table. Must be a power of 2 or power-of-2 plus 1 (see <link linkend="f"><citetitle>f statement</citetitle></link>).
    </para>

    <para>
      <emphasis>a, b, c,</emphasis> etc. -- ordinate values, in odd-numbered pfields p5, p7, p9, . . . These must be nonzero and must be alike in sign.
    </para>

    <para>
      <emphasis>n1, n2</emphasis>, etc. -- length of segment (no. of storage locations), in even-numbered pfields. Cannot be negative, but a zero is meaningful for specifying discontinuous waveforms (e.g. in the example below). The sum <emphasis>n1</emphasis> + <emphasis>n2</emphasis> + .... will normally equal <emphasis>size</emphasis> for fully specified functions. If the sum is smaller, the function locations not included will be set to zero; if the sum is greater, only the first <emphasis>size</emphasis> locations will be stored.
    </para>

    <note>
      <title>Note</title>
      <para>
        <itemizedlist>
          <listitem>
            <para>
              If p4 is positive, functions are post-normalized (rescaled to a maximum absolute value of 1 after generation). A negative p4 will cause rescaling to be skipped.
            </para>
          </listitem>

          <listitem>
            <para>
              Discrete-point linear interpolation implies an increase or decrease along a segment by equal differences between adjacent locations; exponential interpolation implies that the progression is by equal ratio. In both forms the interpolation from <emphasis>a</emphasis> to <emphasis>b</emphasis> is such as to assume that the value <emphasis>b</emphasis> will be attained in the n + 1th location. For discontinuous functions, and for the segment encompassing the end location, this value will not actually be reached, although it may eventually appear as a result of final scaling.
            </para>
          </listitem>
        </itemizedlist>
      </para>
    </note>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is a simple example of the GEN05 routine. It uses the files <ulink url="examples/gen05.orc"><citetitle>gen05.orc</citetitle></ulink> and <ulink url="examples/gen05.sco"><citetitle>gen05.sco</citetitle></ulink>. It will create a nice percussive amplitude envelope. Here is its diagram:

      <mediaobject>
        <imageobject>
          <imagedata fileref="images/gen05.png" format="PNG">
        </imageobject>

        <textobject>
          <phrase>Diagram of the waveform generated by GEN05.</phrase>
        </textobject>

        <caption>
          <para>Diagram of the waveform generated by GEN05.</para>
        </caption>
      </mediaobject>

      <example>
        <title>A simple example of the GEN05 routine.</title>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/gen05.orc" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/gen05.sco" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>
      </example>
    </para>
  </refsect1>

  <refsect1>
     <title>See Also</title>
     <para>
       <link linkend="GEN06"><citetitle>GEN06</citetitle></link>,
       <link linkend="GEN07"><citetitle>GEN07</citetitle></link>, and
       <link linkend="GEN08"><citetitle>GEN08</citetitle></link>
     </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>Example written by &namekevin;</para>
  </refsect1>
</refentry>
