<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="balance">
  <refmeta>
    <refentrytitle>balance</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>balance</refname>
    <refpurpose>
      Adjust one audio signal according to the values of another.
      <indexterm id="IndexBalance"><primary>balance</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      The rms power of asig can be interrogated, set, or adjusted to match that of a comparator signal.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>ar <command>balance</command> asig, acomp [, ihp] [, iskip]</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>ihp</emphasis> (optional) -- half-power point (in Hz) of a special internal low-pass filter. The default value is 10.
    </para>

    <para>
      <emphasis>iskip</emphasis> (optional, default=0) -- initial disposition of internal data space (see <link linkend="reson"><citetitle>reson</citetitle></link>). The default value is 0.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>asig</emphasis> -- input audio signal
    </para>

    <para>
      <emphasis>acomp</emphasis> -- the comparator signal
    </para>

    <para>
      <emphasis>balance</emphasis> outputs a version of <emphasis>asig</emphasis>, amplitude-modified so that its rms power is equal to that of a comparator signal <emphasis>acomp</emphasis>. Thus a signal that has suffered loss of power (eg., in passing through a filter bank) can be restored by matching it with, for instance, its own source. It should be noted that <link linkend="gain"><citetitle>gain</citetitle></link> and <emphasis>balance</emphasis> provide amplitude modification only - output signals are not altered in any other respect.
    </para>
  </refsect1>
 

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

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

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

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

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="gain"><citetitle>gain</citetitle></link>,
      <link linkend="rms"><citetitle>rms</citetitle></link>
    </para>
  </refsect1>
</refentry>
