<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="vco">
  <refmeta>
    <refentrytitle>vco</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>vco</refname>
    <refpurpose>
      Implementation of a band limited, analog modeled oscillator.
      <indexterm id="IndexVco"><primary>vco</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Implementation of a band limited, analog modeled oscillator, based on integration of band limited impulses. <emphasis>vco</emphasis> can be used to simulate a variety of analog wave forms.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>ar <command>vco</command> xamp, xcps, iwave, kpw [, ifn] [, imaxd] [, ileak] [, inyx] [, iphs]</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>iwave</emphasis> -- determines the waveform:
      <itemizedlist>
        <listitem>
          <para><emphasis>iwave</emphasis> = 1 - sawtooth</para>
        </listitem>

        <listitem>
          <para><emphasis>iwave</emphasis> = 2 - Square/PWM</para>
        </listitem>

        <listitem>
          <para><emphasis>iwave</emphasis> = 3 - triangle/Saw/Ramp</para>
        </listitem>
      </itemizedlist>
    </para>

    <para>
      <emphasis>ifn</emphasis> (optional, default = 1) -- should be the table number of a of a stored sine wave.
    </para>

    <para>
      <emphasis>imaxd</emphasis> (optional, default = 1) -- is the maximum delay time. A time of 1/ifqc may be required for the pwm and triangle waveform. To bend the pitch down this value must be as large as 1/(minimum frequency).
    </para>

    <para>
      <emphasis>ileak</emphasis> (optional, default = 0) -- If ileak is between zero and one (0 &lt; ileak &lt; 1) then ileak is used as the leaky integrator value. Otherwise a leaky integrator value of .999 is used for the saw and square waves and .995 is used for the triangle wave. This can be used to <quote>flatten</quote> the square wave or <quote>straighten</quote> the saw wave at low frequencies by setting ileak to .99999 or a similar value. This should give a hollower sounding square wave.
    </para>

    <para>
      <emphasis>inyx</emphasis> (optional, default = .5) -- This is used to determine the number of harmonics in the band limited pulse.  All overtones up to sr * inyx will be used.  The default gives sr * .5 (sr / 2).  For sr / 4 use inyx = .25.  This can generate a <quote>fatter</quote> sound in some cases.
    </para>

    <para>
      <emphasis>iphs</emphasis> (optional, default = 0) -- This is a phase value.  There is an artifact (bug-like feature) in <emphasis>vco</emphasis> which occurs during the first half cycle of the square wave which causes the waveform to be greater in magnitude than all others.  The value of <emphasis>iphs</emphasis> has an effect on this artifact.  In particular setting <emphasis>iphs</emphasis> to .5 will cause the first half cycle of the square wave to resemble a small triangle wave.  This may be more desirable than the large wave artifact which is the current default.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>kpw</emphasis> -- determines either the pulse width (if <emphasis>iwave</emphasis> is 2) or the saw/ramp character (if <emphasis>iwave</emphasis> is 3) The value of <emphasis>kpw</emphasis> should be greater than 0 and less than 2. A value of 1 will generate either a square wave (if <emphasis>iwave</emphasis> is 2) or a triangle wave (if <emphasis>iwave</emphasis> is 3).

    </para>
    <para>
      <emphasis>xamp</emphasis> -- determines the amplitude
    </para>

    <para>
      <emphasis>xcps</emphasis> -- is the frequency of the wave in cycles per second.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the vco opcode. It uses the files <ulink url="examples/vco.orc"><citetitle>vco.orc</citetitle></ulink> and <ulink url="examples/vco.sco"><citetitle>vco.sco</citetitle></ulink>.

      <example>
        <title>Example of the vco opcode.</title>

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

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

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="vco2"><citetitle>vco2</citetitle></link>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: &namehans;</member>
        <member>December 1998</member>
      </simplelist>
    </para>

    <para>New in Csound version 3.50</para>
    <para>November 2002. Corrected the documentation for the <emphasis>kpw</emphasis> parameter thanks to &nameluis; and &namehans;.</para>
  </refsect1>
</refentry>
