<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>tone</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /> <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" /> <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" /> <link rel="prev" href="tlineto.html" title="tlineto" /> <link rel="next" href="tonek.html" title="tonek" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">tone</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="tlineto.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="tonek.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="tone"> <a id="tone"></a> <div class="titlepage"></div> <a id="IndexTone" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">tone</span> </h2> <p>tone — A first-order recursive low-pass filter with variable frequency response. </p> </div> <div class="refsect1" title="Description"> <a id="idp49044424"></a> <h2>Description</h2> <p> A first-order recursive low-pass filter with variable frequency response. </p> <p> <span class="emphasis"><em>tone</em></span> is a 1 term IIR filter. Its formula is: </p> <div class="informalexample"> <p> y<sub>n</sub> = c1 * x<sub>n</sub> + c2 * y<sub>n-1</sub> </p> </div> <p> where </p> <div class="informalexample"> <p> </p> <div class="itemizedlist"> <ul class="itemizedlist" type="disc"> <li class="listitem"> <p>b = 2 - cos(2 π hp/sr);</p> </li> <li class="listitem"> <p>c2 = b - sqrt(b<sup>2</sup> - 1.0)</p> </li> <li class="listitem"> <p>c1 = 1 - c2</p> </li> </ul> </div> <p> </p> </div> <p> </p> </div> <div class="refsect1" title="Syntax"> <a id="idp49055784"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>tone</strong></span> asig, khp [, iskip]</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp49056912"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>iskip</em></span> (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. </p> </div> <div class="refsect1" title="Performance"> <a id="idp49058048"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>ares</em></span> -- the output audio signal. </p> <p> <span class="emphasis"><em>asig</em></span> -- the input audio signal. </p> <p> <span class="emphasis"><em>khp</em></span> -- the response curve's half-power point, in Hertz. Half power is defined as peak power / root 2. </p> <p> <span class="emphasis"><em>tone</em></span> implements a first-order recursive low-pass filter in which the variable <span class="emphasis"><em>khp</em></span> (in Hz) determines the response curve's half-power point. Half power is defined as peak power / root 2. </p> </div> <div class="refsect1" title="Examples"> <a id="idp49142264"></a> <h2>Examples</h2> <p> Here is an example of the tone opcode. It uses the file <a class="ulink" href="examples/tone.csd" target="_top"><em class="citetitle">tone.csd</em></a>. </p> <div class="example"> <a id="idp49143232"></a> <p class="title"> <strong>Example 887. Example of the tone opcode.</strong> </p> <div class="example-contents"> <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p> <pre class="programlisting"> <span class="csdtag"><CsoundSynthesizer></span> <span class="csdtag"><CsOptions></span> <span class="comment">; Select audio/midi flags here according to platform</span> -odac <span class="comment">;;;realtime audio out</span> <span class="comment">;-iadc ;;;uncomment -iadc if realtime audio input is needed too</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o tone.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="ohdr">sr</span> <span class="op">=</span> 44100 <span class="ohdr">ksmps</span> <span class="op">=</span> 32 <span class="ohdr">0dbfs</span> <span class="op">=</span> 1 <span class="ohdr">nchnls</span> <span class="op">=</span> 2 <span class="oblock">instr</span> 1 asig <span class="opc">diskin2</span> "beats.wav", 1 <span class="opc">outs</span> asig, asig <span class="oblock">endin</span> <span class="oblock">instr</span> 2 kton <span class="opc">line</span> 10000, p3, 0 <span class="comment">;all the way down to 0 Hz</span> asig <span class="opc">diskin2</span> "beats.wav", 1 asig <span class="opc">tone</span> asig, kton <span class="comment">;half-power point at 500 Hz</span> <span class="opc">outs</span> asig, asig <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">i</span> 1 0 2 <span class="stamnt">i</span> 2 2 2 <span class="stamnt">e</span> <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1" title="See Also"> <a id="idp49145496"></a> <h2>See Also</h2> <p> <a class="link" href="areson.html" title="areson"><em class="citetitle">areson</em></a>, <a class="link" href="aresonk.html" title="aresonk"><em class="citetitle">aresonk</em></a>, <a class="link" href="atone.html" title="atone"><em class="citetitle">atone</em></a>, <a class="link" href="atonek.html" title="atonek"><em class="citetitle">atonek</em></a>, <a class="link" href="port.html" title="port"><em class="citetitle">port</em></a>, <a class="link" href="portk.html" title="portk"><em class="citetitle">portk</em></a>, <a class="link" href="reson.html" title="reson"><em class="citetitle">reson</em></a>, <a class="link" href="resonk.html" title="resonk"><em class="citetitle">resonk</em></a>, <a class="link" href="tonek.html" title="tonek"><em class="citetitle">tonek</em></a> </p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="tlineto.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="OpcodesTop.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="tonek.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">tlineto </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> tonek</td> </tr> </table> </div> </body> </html>