| 1 | |
| 2 | <refentry id="balance2"> |
| 3 | <indexterm id="IndexBalance2"><primary>balance2</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Amplitude Modifiers</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>balance2</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>balance2</refname> |
| 13 | <refpurpose> |
| 14 | Adjust one audio signal according to the values of another. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | The rms power of asig can be interrogated, set, or adjusted to match that of a comparator signal. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>ares <command>balance2</command> asig, acomp [, ihp] [, iskip]</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>ihp</emphasis> (optional) -- half-power point (in Hz) of a special internal low-pass filter. The default value is 10. |
| 34 | </para> |
| 35 | |
| 36 | <para> |
| 37 | <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. |
| 38 | </para> |
| 39 | </refsect1> |
| 40 | |
| 41 | <refsect1> |
| 42 | <title>Performance</title> |
| 43 | <para> |
| 44 | <emphasis>asig</emphasis> -- input audio signal |
| 45 | </para> |
| 46 | |
| 47 | <para> |
| 48 | <emphasis>acomp</emphasis> -- the comparator signal |
| 49 | </para> |
| 50 | |
| 51 | <para> |
| 52 | <emphasis>balance2</emphasis> outputs a version of |
| 53 | <emphasis>asig</emphasis>, amplitude-modified so that its rms |
| 54 | power is equal to that of a comparator signal |
| 55 | <emphasis>acomp</emphasis>. Thus a signal that has suffered loss |
| 56 | of power (eg., in passing through a filter bank) can be restored |
| 57 | by matching it with, for instance, its own source. It should be |
| 58 | noted that <link |
| 59 | linkend="gain"><citetitle>gain</citetitle></link> and |
| 60 | <emphasis>balance2</emphasis> provide amplitude modification |
| 61 | only - output signals are not altered in any other respect. |
| 62 | </para> |
| 63 | <para> |
| 64 | Note that <emphasis>balance2</emphasis> is just like |
| 65 | <emphasis>balance</emphasis> except the gain is recalculated for |
| 66 | every sample rather than interpolating k-rate values. |
| 67 | </para> |
| 68 | </refsect1> |
| 69 | |
| 70 | |
| 71 | <refsect1> |
| 72 | <title>Examples</title> |
| 73 | <para> |
| 74 | Here is an example of the balance2 opcode. It uses the file <ulink url="examples/balance2.csd"><citetitle>balance2.csd</citetitle></ulink>. |
| 75 | |
| 76 | <example> |
| 77 | <title>Example of the balance2 opcode.</title> |
| 78 | |
| 79 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 80 | <xi:include href="examples-xml/balance2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 81 | </example> |
| 82 | </para> |
| 83 | </refsect1> |
| 84 | |
| 85 | <refsect1> |
| 86 | <title>See also</title> |
| 87 | <para><link linkend="SigProcAmpMod"><citetitle>Amplitude Modifiers and Dynamic processing</citetitle></link></para> |
| 88 | </refsect1> |
| 89 | |
| 90 | <refsect1> |
| 91 | <title>Credits</title> |
| 92 | <para> |
| 93 | <simplelist> |
| 94 | <member>Author: &namevictor;;</member> |
| 95 | <member>March 2018</member> |
| 96 | </simplelist> |
| 97 | </para> |
| 98 | |
| 99 | <para>New in Csound version 6.11</para> |
| 100 | </refsect1> |
| 101 | </refentry> |