<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="phasor">
  <refmeta>
    <refentrytitle>phasor</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>phasor</refname>
    <refpurpose>
      Produce a normalized moving phase value.
      <indexterm id="IndexPhasor"><primary>phasor</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Produce a normalized moving phase value.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>ar <command>phasor</command> xcps [, iphs]</synopsis>

    <synopsis>kr <command>phasor</command> kcps [, iphs]</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>iphs</emphasis> (optional) -- initial phase, expressed as a fraction of a cycle (0 to 1). A negative value will cause phase initialization to be skipped. The default value is zero.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      An internal phase is successively accumulated in accordance with the <emphasis>kcps</emphasis> or <emphasis>xcps</emphasis> frequency to produce a moving phase value, normalized to lie in the range 0 &lt;= phs &lt; 1.
    </para>

    <para>
      When used as the index to a <emphasis>table</emphasis> unit, this phase (multiplied by the desired function table length) will cause it to behave like an oscillator.
    </para>

    <para>
      Note that <emphasis>phasor</emphasis> is a special kind of integrator, accumulating phase increments that represent frequency settings.
    </para>
  </refsect1>

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

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

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

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

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