<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="GEN14">
  <refmeta>
    <refentrytitle>GEN14</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>GEN14</refname>
    <refpurpose>
      Stores a polynomial whose coefficients derive from Chebyshevs of the second kind.
      <indexterm id="IndexGEN14"><primary>GEN14</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Uses Chebyshev coefficients to generate stored polynomial functions which, under waveshaping, can be used to split a sinusoid into harmonic partials having a pre-definable spectrum.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>f</command> # time size 14 xint xamp h0 h1 h2 ...</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>size</emphasis> -- number of points in the table. Must be a power of 2 or a power-of-2 plus 1 (see <link linkend="f"><citetitle>f statement</citetitle></link>). The normal value is power-of-2 plus 1.
    </para>

    <para>
      <emphasis>xint</emphasis> -- provides the left and right values [<emphasis>-xint, +xint</emphasis>] of the x interval over which the polynomial is to be drawn. These subroutines both call <link linkend="GEN03"><citetitle>GEN03</citetitle></link> to draw their functions; the p5 value here is therefore expanded to a negative-positive p5, p6 pair before <emphasis>GEN03</emphasis> is actually called. The normal value is 1.
    </para>

    <para>
      <emphasis>xamp </emphasis> -- amplitude scaling factor of the sinusoid input that is expected to produce the following spectrum.
    </para>

    <para>
      <emphasis>h0, h1, h2,</emphasis> etc. -- relative strength of partials 0 (DC), 1 (fundamental), 2 ... that will result when a sinusoid of amplitude

      <literallayout>
xamp * int(size/2)/xint
      </literallayout>

      is waveshaped using this function table. These values thus describe a frequency spectrum associated with a particular factor <emphasis>xamp</emphasis> of the input signal.
    </para>

    <note>
      <title>Note</title>
      <para>
        <itemizedlist>
          <listitem>
            <para>
              <link linkend="GEN13"><citetitle>GEN13</citetitle></link> is the function generator normally employed in standard waveshaping. It stores a polynomial whose coefficients derive from the Chebyshev polynomials of the first kind, so that a driving sinusoid of strength <emphasis>xamp</emphasis> will exhibit the specified spectrum at output. Note that the evolution of this spectrum is generally not linear with varying <emphasis>xamp</emphasis>. However, it is bandlimited (the only partials to appear will be those specified at generation time); and the partials will tend to occur and to develop in ascending order (the lower partials dominating at low <emphasis>xamp</emphasis>, and the spectral richness increasing for higher values of <emphasis>xamp</emphasis>). A negative <emphasis>hn</emphasis> value implies a 180 degree phase shift of that partial; the requested full-amplitude spectrum will not be affected by this shift, although the evolution of several of its component partials may be. The pattern +,+,-,-,+,+,... for <emphasis>h0,h1,h2..</emphasis>. will minimize the normalization problem for low <emphasis>xamp</emphasis> values (see above), but does not necessarily provide the smoothest pattern of evolution.
            </para>
          </listitem>

          <listitem>
            <para>
              <emphasis>GEN14</emphasis> stores a polynomial whose coefficients derive from Chebyshevs of the second kind.
            </para>
          </listitem>
        </itemizedlist>
      </para>
    </note>
  </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      Here is a simple example of the GEN14 routine. It uses the files <ulink url="examples/gen14.orc"><citetitle>gen14.orc</citetitle></ulink> and <ulink url="examples/gen14.sco"><citetitle>gen14.sco</citetitle></ulink>. It creates a function which, under waveshaping, will split a sinusoid into 3 odd-harmonic partials of relative strength 5:3:1. Here is its diagram:

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

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

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

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

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

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

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="GEN03"><citetitle>GEN03</citetitle></link>,
      <link linkend="GEN13"><citetitle>GEN13</citetitle></link>, and
      <link linkend="GEN15"><citetitle>GEN15</citetitle></link>.
    </para>
  </refsect1>

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