<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="oscili">
  <refmeta>
    <refentrytitle>oscili</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>oscili</refname>
    <refpurpose>
      A simple oscillator with linear interpolation.
      <indexterm id="IndexOscili"><primary>oscili</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>oscili</command> xamp, xcps, ifn [, iphs]</synopsis>

    <synopsis>kr <command>oscili</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) -- 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>
      <emphasis>oscili</emphasis> differs from <link linkend="oscil"><citetitle>oscil</citetitle></link> in that the standard procedure of using a truncated phase as a sampling index is here replaced by a process that interpolates between two successive lookups. Interpolating generators will produce a noticeably cleaner output signal, but they may take as much as twice as long to run. Adequate accuracy can also be gained without the time cost of interpolation by using large stored function tables of 2K, 4K or 8K points if the space is available.
    </para>
 </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the oscili opcode. It uses the files <ulink url="examples/oscili.orc"><citetitle>oscili.orc</citetitle></ulink> and <ulink url="examples/oscili.sco"><citetitle>oscili.sco</citetitle></ulink>.

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

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

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

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

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