<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="distort1">
  <refmeta>
    <refentrytitle>distort1</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>distort1</refname>
    <refpurpose>
      Modified hyperbolic tangent distortion.
      <indexterm id="IndexDistort1"><primary>distort1</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Implementation of modified hyperbolic tangent distortion. <emphasis>distort1</emphasis> can be used to generate wave shaping distortion based on a modification of the <link linkend="tanh"><citetitle>tanh</citetitle></link> function.
    </para>

    <para>
      <literallayout>
         exp(asig * (pregain + shape1)) - exp(asig*(pregain+shape2))
  aout = -----------------------------------------------------------
         exp(asig*pregain)              + exp(-asig*pregain)
      </literallayout>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>ar <command>distort1</command> asig, kpregain, kpostgain, kshape1, kshape2</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>asig - </emphasis>is the input signal.
    </para>

    <para>
      <emphasis>kpregain</emphasis> -- determines the amount of gain applied to the signal before waveshaping. A value of 1 gives slight distortion.
    </para>

    <para>
      <emphasis>kpostgain</emphasis> -- determines the amount of gain applied to the signal after waveshaping.
    </para>

    <para>
      <emphasis>kshape1</emphasis> -- determines the shape of the positive part of the curve. A value of 0 gives a flat clip, small positive values give sloped shaping.
    </para>

    <para>
      <emphasis>kshape2</emphasis> -- determines the shape of the negative part of the curve.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the distort1 opcode. It uses the files <ulink url="examples/distort1.orc"><citetitle>distort1.orc</citetitle></ulink> and <ulink url="examples/distort1.sco"><citetitle>distort1.sco</citetitle></ulink>.

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

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

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/distort1.sco" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>
      </example>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: &namehans;</member>
        <member>December 1998</member>
      </simplelist>
    </para>

    <para>New in Csound version 3.50</para>
  </refsect1>
</refentry>
