<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="oscil">
  <refmeta>
    <refentrytitle>oscil</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>oscil</refname>
    <refpurpose>
      A simple oscillator.
      <indexterm id="IndexOscil"><primary>oscil</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Table <emphasis>ifn</emphasis> is incrementally sampled modulo the table length and the value obtained is multiplied by <emphasis>amp</emphasis>.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>ar <command>oscil</command> xamp, xcps, ifn [, iphs]</synopsis>

    <synopsis>kr <command>oscil</command> kamp, kcps, ifn [, iphs]</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>ifn</emphasis> -- function table number. Requires a wrap-around guard point.
    </para>

    <para>
      <emphasis>iphs</emphasis> (optional, default=0) -- initial phase of sampling, expressed as a fraction of a cycle (0 to 1). A negative value will cause phase initialization to be skipped. The default value is 0.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>kamp, xamp</emphasis> -- amplitude
    </para>

    <para>
      <emphasis>kcps, xcps</emphasis> -- frequency in cycles per second.
    </para>

    <para>
      The <emphasis>oscil</emphasis> opcode generates periodic control (or audio) signals consisting of the value of <emphasis>kamp</emphasis>(<emphasis>xamp</emphasis>)times the value returned from control rate (audio rate) sampling of a stored function table. The internal phase is simultaneously advanced in accordance with the <emphasis>kcps</emphasis> or <emphasis>xcps</emphasis> input value.
    </para>
 </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the oscil opcode. It uses the files <ulink url="examples/oscil.orc"><citetitle>oscil.orc</citetitle></ulink> and <ulink url="examples/oscil.sco"><citetitle>oscil.sco</citetitle></ulink>.

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

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

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

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="oscili"><citetitle>oscili</citetitle></link>, 
      <link linkend="oscil3"><citetitle>oscil3</citetitle></link>
    </para>
  </refsect1>

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