<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="GEN09">
  <refmeta>
    <refentrytitle>GEN09</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>GEN09</refname>
    <refpurpose>
      Generate composite waveforms made up of weighted sums of simple sinusoids.
      <indexterm id="IndexGEN09"><primary>GEN09</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      These subroutines generate composite waveforms made up of weighted sums of simple sinusoids. The specification of each contributing partial requires 3 p-fields using <emphasis>GEN09</emphasis>.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>f</command> # time size 9 pna stra phsa pnb strb phsb ...</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>pna, pnb</emphasis>, etc. -- partial no. (relative to a fundamental that would occupy <emphasis>size</emphasis> locations per cycle) of sinusoid a, sinusoid b, etc. Must be positive, but need not be a whole number, i.e., non-harmonic partials are permitted. Partials may be in any order.
    </para>

    <para>
      <emphasis>stra, strb</emphasis>, etc. -- strength of partials <emphasis>pna, pnb</emphasis>, etc. These are relative strengths, since the composite waveform may be rescaled later. Negative values are permitted and imply a 180 degree phase shift.
    </para>

    <para>
      <emphasis>phsa, phsb</emphasis>, etc. -- initial phase of partials <emphasis>pna, pnb,</emphasis> etc., expressed in degrees (0-360).
    </para>

    <note>
      <title>Note</title>
      <para>
        <itemizedlist>
          <listitem>
            <para>
              These subroutines generate stored functions as sums of sinusoids of different frequencies. The two major restrictions on <emphasis>GEN10</emphasis> that the partials be harmonic and in phase do not apply to <emphasis>GEN09</emphasis> or <emphasis>GEN19</emphasis>.
            </para>

            <para>
              In each case the composite wave, once drawn, is then rescaled to unity if p4 was positive. A negative p4 will cause rescaling to be skipped.
            </para>
          </listitem>
        </itemizedlist>
      </para>
    </note>
  </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      Here is a simple example of the GEN09 routine. It uses the files <ulink url="examples/gen09.orc"><citetitle>gen09.orc</citetitle></ulink> and <ulink url="examples/gen09.sco"><citetitle>gen09.sco</citetitle></ulink>.  It will generate a cosine wave, a sine wave with an initial phase of 90 degrees. Here is its diagram:
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/gen09.png" format="PNG">
        </imageobject>

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

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

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

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

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

    <para>
      Here is another example of the GEN09 routine. It uses the files <ulink url="examples/gen09square.orc"><citetitle>gen09square.orc</citetitle></ulink> and <ulink url="examples/gen09square.sco"><citetitle>gen09square.sco</citetitle></ulink>. It combines partials l, 3 and 9 in the relative strengths in which they are found in a square wave, except that partial 9 is upside down. It will be rescaled, here is its diagram:
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/gen09square.png" format="PNG">
        </imageobject>

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

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

      <example>
        <title>A square wave generated by the GEN09 routine.</title>

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

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

  <refsect1>
     <title>See Also</title>
     <para>
       <link linkend="GEN10"><citetitle>GEN10</citetitle></link>, 
       <link linkend="GEN19"><citetitle>GEN19</citetitle></link>
     </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>The simple example was written by &namekevin;.</para>
  </refsect1>
</refentry>
