<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="GEN11">
  <refmeta>
    <refentrytitle>GEN11</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>GEN11</refname>
    <refpurpose>
      Generates an additive set of cosine partials.
      <indexterm id="IndexGEN11"><primary>GEN11</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      This subroutine generates an additive set of cosine partials, in the manner of Csound generators <link linkend="buzz"><citetitle>buzz</citetitle></link> and <link linkend="gbuzz"><citetitle>gbuzz</citetitle></link>.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>f</command> # time size 11 nh [lh] [r]</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>nh</emphasis> -- number of harmonics requested. Must be positive.
    </para>

    <para>
      <emphasis>lh</emphasis>(optional) -- lowest harmonic partial present. Can be positive, zero or negative. The set of partials can begin at any partial number and proceeds upwards; if <emphasis>lh</emphasis> is negative, all partials below zero will reflect in zero to produce positive partials without phase change (since cosine is an even function), and will add constructively to any positive partials in the set. The default value is 1
    </para>

    <para>
      <emphasis>r</emphasis>(optional) -- multiplier in an amplitude coefficient series. This is a power series: if the <emphasis>lh</emphasis>th partial has a strength coefficient of A the (<emphasis>lh</emphasis> + n)th partial will have a coefficient of A * r<superscript>n</superscript>, i.e. strength values trace an exponential curve. <emphasis>r</emphasis> may be positive, zero or negative, and is not restricted to integers. The default value is 1.
    </para>

    <note>
     <title>Note</title>
     <para>
       <itemizedlist>
         <listitem>
           <para>
             This subroutine is a non-time-varying version of the CSound <link linkend="buzz"><citetitle>buzz</citetitle></link>and <link linkend="gbuzz"><citetitle>gbuzz</citetitle></link> generators, and is similarly useful as a complex sound source in subtractive synthesis. With <emphasis>lh</emphasis> and <emphasis>r</emphasis> present it parallels <emphasis>gbuzz</emphasis>; with both absent or equal to 1 it reduces to the simpler <emphasis>buzz</emphasis> (i.e. <emphasis>nh</emphasis> equal-strength harmonic partials beginning with the fundamental).
           </para>
         </listitem>

         <listitem>
           <para>
             Sampling the stored waveform with an oscillator is more efficient than using the dynamic buzz units. However, the spectral content is invariant and care is necessary, lest the higher partials exceed the Nyquist during sampling to produce fold-over.
           </para>
         </listitem>
       </itemizedlist>
      </para>
    </note>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is a simple example of the GEN11 routine. It uses the files <ulink url="examples/gen11.orc"><citetitle>gen11.orc</citetitle></ulink> and <ulink url="examples/gen11.sco"><citetitle>gen11.sco</citetitle></ulink>.  It will generate a simple cosine wave. Here is its diagram:
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/gen11.png" format="PNG">
        </imageobject>

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

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

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

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

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

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

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