| 1 | |
| 2 | <refentry id="tone"> |
| 3 | <indexterm id="IndexTone"><primary>tone</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Standard Filters</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>tone</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>tone</refname> |
| 13 | <refpurpose> |
| 14 | A first-order recursive low-pass filter with variable frequency response. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | A first-order recursive low-pass filter with variable frequency response. |
| 22 | </para> |
| 23 | |
| 24 | <para> |
| 25 | <emphasis>tone</emphasis> is a 1 term IIR filter. Its formula is: |
| 26 | <informalexample> |
| 27 | <para> |
| 28 | y<subscript>n</subscript> = c1 * x<subscript>n</subscript> + c2 * y<subscript>n-1</subscript> |
| 29 | </para> |
| 30 | </informalexample> |
| 31 | |
| 32 | where |
| 33 | |
| 34 | <informalexample> |
| 35 | <para> |
| 36 | <itemizedlist> |
| 37 | <listitem> |
| 38 | <para>b = 2 - cos(2 π hp/sr);</para> |
| 39 | </listitem> |
| 40 | <listitem> |
| 41 | <para>c2 = b - sqrt(b<superscript>2</superscript> - 1.0)</para> |
| 42 | </listitem> |
| 43 | <listitem> |
| 44 | <para>c1 = 1 - c2</para> |
| 45 | </listitem> |
| 46 | </itemizedlist> |
| 47 | </para> |
| 48 | </informalexample> |
| 49 | </para> |
| 50 | </refsect1> |
| 51 | |
| 52 | <refsect1> |
| 53 | <title>Syntax</title> |
| 54 | <synopsis>ares <command>tone</command> asig, khp [, iskip]</synopsis> |
| 55 | </refsect1> |
| 56 | |
| 57 | <refsect1> |
| 58 | <title>Initialization</title> |
| 59 | <para> |
| 60 | <emphasis>iskip</emphasis> (optional, default=0) -- initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0. |
| 61 | </para> |
| 62 | </refsect1> |
| 63 | |
| 64 | <refsect1> |
| 65 | <title>Performance</title> |
| 66 | <para> |
| 67 | <emphasis>ares</emphasis> -- the output audio signal. |
| 68 | </para> |
| 69 | |
| 70 | <para> |
| 71 | <emphasis>asig</emphasis> -- the input audio signal. |
| 72 | </para> |
| 73 | |
| 74 | <para> |
| 75 | <emphasis>khp</emphasis> -- the response curve's half-power point, in Hertz. Half power is defined as peak power / root 2. |
| 76 | </para> |
| 77 | |
| 78 | <para> |
| 79 | <emphasis>tone</emphasis> implements a first-order recursive low-pass filter in which the variable <emphasis>khp</emphasis> (in Hz) determines the response curve's half-power point. Half power is defined as peak power / root 2. |
| 80 | </para> |
| 81 | </refsect1> |
| 82 | |
| 83 | <refsect1> |
| 84 | <title>Examples</title> |
| 85 | <para> |
| 86 | Here is an example of the tone opcode. It uses the file <ulink url="examples/tone.csd"><citetitle>tone.csd</citetitle></ulink>. |
| 87 | <example> |
| 88 | <title>Example of the tone opcode.</title> |
| 89 | <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> |
| 90 | <xi:include href="examples-xml/tone.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 91 | </example> |
| 92 | </para> |
| 93 | </refsect1> |
| 94 | |
| 95 | <refsect1> |
| 96 | <title>See also</title> |
| 97 | <para><link linkend="SigmodStandard"><citetitle>Standard filters: Low-pass filters</citetitle></link></para> |
| 98 | </refsect1> |
| 99 | |
| 100 | </refentry> |