<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="foscil">
  <refmeta>
    <refentrytitle>foscil</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>foscil</refname>
    <refpurpose>
      A basic frequency modulated oscillator.
      <indexterm id="Indexfoscil"><primary>foscil</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      A basic frequency modulated oscillator.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>ar <command>foscil</command> xamp, kcps, xcar, xmod, kndx, 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 waveform in table <emphasis>ifn</emphasis>, 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>xamp</emphasis> -- the amplitude of the output signal.
    </para>

    <para>
      <emphasis>kcps</emphasis> -- a common denominator, in cycles per second, for the carrier and modulating frequencies.
    </para>

    <para>
      <emphasis>xcar</emphasis> -- a factor that, when multiplied by the <emphasis>kcps</emphasis> parameter, gives the carrier frequency.
    </para>

    <para>
      <emphasis>xmod</emphasis> -- a factor that, when multiplied by the <emphasis>kcps</emphasis> parameter, gives the modulating frequency.
    </para>

    <para>
      <emphasis>kndx</emphasis> -- the modulation index.
    </para>

    <para>
      <emphasis>foscil</emphasis> is a composite unit that effectively banks two <emphasis>oscil</emphasis> opcodes in the familiar Chowning FM setup, wherein the audio-rate output of one generator is used to modulate the frequency input of another (the <quote>carrier</quote>). Effective carrier frequency = <emphasis>kcps</emphasis> * <emphasis>xcar</emphasis>, and modulating frequency = <emphasis>kcps</emphasis> * <emphasis>xmod</emphasis>. For integral values of <emphasis>xcar</emphasis> and <emphasis>xmod</emphasis>, the perceived fundamental will be the minimum positive value of <emphasis>kcps</emphasis> * (<emphasis>xcar</emphasis> -- n * <emphasis>xmod</emphasis>), n = 1,1,2,... The input <emphasis>kndx</emphasis> is the index of modulation (usually time-varying and ranging 0 to 4 or so) which determines the spread of acoustic energy over the partial positions given by n = 0,1,2,.., etc. <emphasis>ifn</emphasis> should point to a stored sine wave. Previous to version 3.50, <emphasis>xcar</emphasis> and <emphasis>xmod</emphasis> could be k-rate only.
    </para>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the foscil opcode. It uses the files <ulink url="examples/foscil.orc"><citetitle>foscil.orc</citetitle></ulink> and <ulink url="examples/foscil.sco"><citetitle>foscil.sco</citetitle></ulink>.

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

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

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

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