<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="diff">
  <refmeta>
    <refentrytitle>diff</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>diff</refname>
    <refpurpose>
      Modify a signal by differentiation.
      <indexterm id="IndexDiff"><primary>diff</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Modify a signal by differentiation.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>ar <command>diff</command> asig [, iskip]</synopsis>

    <synopsis>kr <command>diff</command> ksig [, iskip]</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>iskip</emphasis> (optional) -- initial disposition of internal save space (see <link linkend="reson"><citetitle>reson</citetitle></link>). The default value is 0.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      <link linkend="integ"><citetitle>integ</citetitle></link> and <emphasis>diff</emphasis> perform integration and differentiation on an input control signal or audio signal. Each is the converse of the other, and applying both will reconstruct the original signal. Since these units are special cases of low-pass and high-pass filters, they produce a scaled (and phase shifted) output that is frequency-dependent. Thus <emphasis>diff</emphasis> of a sine produces a cosine, with amplitude <emphasis>2 * sin(pi * Hz / <emphasis>sr</emphasis>)</emphasis> that of the original (for each component partial); <emphasis>integ</emphasis> will inversely affect the magnitudes of its component inputs. With this understanding, these units can provide useful signal modification.
    </para>
  </refsect1>

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

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

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

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

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="downsamp"><citetitle>downsamp</citetitle></link>, 
      <link linkend="integ"><citetitle>integ</citetitle></link>, 
      <link linkend="interp"><citetitle>interp</citetitle></link>, 
      <link linkend="samphold"><citetitle>samphold</citetitle></link>, 
      <link linkend="upsamp"><citetitle>upsamp</citetitle></link>
    </para>
  </refsect1>

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