<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="GEN19">
  <refmeta>
    <refentrytitle>GEN19</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>GEN19</refname>
    <refpurpose>
      Generate composite waveforms made up of weighted sums of simple sinusoids.
      <indexterm id="IndexGEN19"><primary>GEN19</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 4 p-fields using <emphasis>GEN19</emphasis>.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>f</command> # time size  19  pna   stra  phsa  dcoa  pnb strb  phsb  dcob  ...</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.
    </para>

    <para>
      <emphasis>dcoa, dcob</emphasis>, etc. -- DC offset of partials <emphasis>pna, pnb</emphasis>, etc. This is applied <emphasis>after</emphasis> strength scaling, i.e. a value of 2 will lift a 2-strength sinusoid from range [-2,2] to range [0,4] (before later rescaling).
    </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 GEN19 routine. It uses the files <ulink url="examples/gen19.orc"><citetitle>gen19.orc</citetitle></ulink> and <ulink url="examples/gen19.sco"><citetitle>gen19.sco</citetitle></ulink>.  It will generate a nice bell curve, here is its diagram:
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/gen19.png" format="PNG">
        </imageobject>

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

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

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

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

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

  <refsect1>
     <title>See Also</title>
     <para>
       <link linkend="GEN09"><citetitle>GEN09</citetitle></link> and
       <link linkend="GEN10"><citetitle>GEN10</citetitle></link>
     </para>
  </refsect1>

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