<?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>clfilt</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="clear.html" title="clear" /> <link rel="next" href="clip.html" title="clip" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">clfilt</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="clear.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="clip.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="clfilt"> <a id="clfilt"></a> <div class="titlepage"></div> <a id="IndexClfilt" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">clfilt</span> </h2> <p>clfilt — Implements low-pass and high-pass filters of different styles. </p> </div> <div class="refsect1" title="Description"> <a id="idp16045336"></a> <h2>Description</h2> <p> Implements the classical standard analog filter types: low-pass and high-pass. They are implemented with the four classical kinds of filters: Butterworth, Chebyshev Type I, Chebyshev Type II, and Elliptical. The number of poles may be any even number from 2 to 80. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp16067360"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>clfilt</strong></span> asig, kfreq, itype, inpol [, ikind] [, ipbr] [, isba] [, iskip]</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp16068544"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>itype</em></span> -- 0 for low-pass, 1 for high-pass. </p> <p> <span class="emphasis"><em>inpol</em></span> -- The number of poles in the filter. It must be an even number from 2 to 80. </p> <p> <span class="emphasis"><em>ikind</em></span> (optional) -- 0 for Butterworth, 1 for Chebyshev Type I, 2 for Chebyshev Type II, 3 for Elliptical. Defaults to 0 (Butterworth) </p> <p> <span class="emphasis"><em>ipbr</em></span> (optional) -- The pass-band ripple in dB. Must be greater than 0. It is ignored by Butterworth and Chebyshev Type II. The default is 1 dB. </p> <p> <span class="emphasis"><em>isba</em></span> (optional) -- The stop-band attenuation in dB. Must be less than 0. It is ignored by Butterworth and Chebyshev Type I. The default is -60 dB. </p> <p> <span class="emphasis"><em>iskip</em></span> (optional) -- 0 initializes all filter internal states to 0. 1 skips initialization. The default is 0. </p> </div> <div class="refsect1" title="Performance"> <a id="idp16072808"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>asig</em></span> -- The input audio signal. </p> <p> <span class="emphasis"><em>kfreq</em></span> -- The corner frequency for low-pass or high-pass. </p> </div> <div class="refsect1" title="Examples"> <a id="idp16074232"></a> <h2>Examples</h2> <p> Here is an example of the clfilt opcode as a low-pass filter. It uses the file <a class="ulink" href="examples/clfilt_lowpass.csd" target="_top"><em class="citetitle">clfilt_lowpass.csd</em></a>. </p> <div class="example"> <a id="idp16075248"></a> <p class="title"> <strong>Example 110. Example of the clfilt opcode as a low-pass filter.</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">;;;RT audio out</span> <span class="comment">;-iadc ;;;uncomment -iadc if RT audio input is needed too</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o clfilt_lowpass.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">nchnls</span> <span class="op">=</span> 2 <span class="ohdr">0dbfs</span> <span class="op">=</span> 1 <span class="oblock">instr</span> 1 <span class="comment">; white noise</span> asig <span class="opc">rand</span> 0.5 <span class="opc">outs</span> asig, asig <span class="oblock">endin</span> <span class="oblock">instr</span> 2 <span class="comment">; filtered noise </span> asig <span class="opc">rand</span> 0.9 <span class="comment">; Lowpass filter signal asig with a </span> <span class="comment">; 10-pole Butterworth at 500 Hz.</span> a1 <span class="opc">clfilt</span> asig, 500, 0, 10 <span class="opc">outs</span> a1, a1 <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> <p> Here is an example of the clfilt opcode as a high-pass filter. It uses the file <a class="ulink" href="examples/clfilt_highpass.csd" target="_top"><em class="citetitle">clfilt_highpass.csd</em></a>. </p> <div class="example"> <a id="idp16078160"></a> <p class="title"> <strong>Example 111. Example of the clfilt opcode as a high-pass filter.</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">;;;RT audio out</span> <span class="comment">;-iadc ;;;uncomment -iadc if RT audio input is needed too</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o clfilt_highpass.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">nchnls</span> <span class="op">=</span> 2 <span class="ohdr">0dbfs</span> <span class="op">=</span> 1 <span class="oblock">instr</span> 1 <span class="comment">; white noise</span> asig <span class="opc">rand</span> 0.6 <span class="opc">outs</span> asig, asig <span class="oblock">endin</span> <span class="oblock">instr</span> 2 <span class="comment">;filtered noise</span> asig <span class="opc">rand</span> 0.7 <span class="comment">; Highpass filter signal asig with a 6-pole Chebyshev</span> <span class="comment">; Type I at 20 Hz with 3 dB of passband ripple.</span> a1 <span class="opc">clfilt</span> asig, 20, 1, 6, 1, 3 <span class="opc">outs</span> a1, a1 <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="Credits"> <a id="idp16080432"></a> <h2>Credits</h2> <p>Author: Erik Spjut</p> <p>New in version 4.20</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="clear.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="clip.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">clear </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> clip</td> </tr> </table> </div> </body> </html>