<?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>filter2</title> <link rel="stylesheet" href="csound.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /> <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="filevalid.html" title="filevalid" /> <link rel="next" href="fin.html" title="fin" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">filter2</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="filevalid.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="fin.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="filter2"> <a id="filter2"></a> <div class="titlepage"></div> <a id="IndexFilter2" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">filter2</span> </h2> <p>filter2 — Performs filtering using a transposed form-II digital filter lattice with no time-varying control. </p> </div> <div class="refsect1" title="Description"> <a id="id2849401"></a> <h2>Description</h2> <p> General purpose custom filter with no time-varying pole control. The filter coefficients implement the following difference equation: </p> <div class="literallayout"> <p><br /> (1)*y(n) = b0*x[n] + b1*x[n-1] +...+ bM*x[n-M] - a1*y[n-1] -...- aN*y[n-N]<br /> </p> </div> <p> </p> <p> the system function for which is represented by: </p> <div class="literallayout"> <p><br /> B(Z) b0 + b1*Z<sup>-1</sup> + ... + bM*Z<sup>-M</sup><br /> H(Z) = ---- = --------------------------<br /> A(Z) 1 + a1*Z<sup>-1</sup> + ... + aN*Z<sup>-N</sup><br /> </p> </div> <p> </p> </div> <div class="refsect1" title="Syntax"> <a id="id2850148"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>filter2</strong></span> asig, iM, iN, ib0, ib1, ..., ibM, ia1, ia2, ..., iaN</pre> <pre class="synopsis">kres <span class="command"><strong>filter2</strong></span> ksig, iM, iN, ib0, ib1, ..., ibM, ia1, ia2, ..., iaN</pre> </div> <div class="refsect1" title="Initialization"> <a id="id2850180"></a> <h2>Initialization</h2> <p> At initialization the number of zeros and poles of the filter are specified along with the corresponding zero and pole coefficients. The coefficients must be obtained by an external filter-design application such as Matlab and specified directly or loaded into a table via <a class="link" href="GEN01.html" title="GEN01"><em class="citetitle">GEN01</em></a>. </p> </div> <div class="refsect1" title="Performance"> <a id="id2850203"></a> <h2>Performance</h2> <p> The<span class="emphasis"><em> filter2</em></span> opcodes perform filtering using a transposed form-II digital filter lattice with no time-varying control. </p> <p> Since <span class="emphasis"><em>filter2</em></span> implements generalized recursive filters, it can be used to specify a large range of general DSP algorithms. For example, a digital waveguide can be implemented for musical instrument modeling using a pair of <a class="link" href="delayr.html" title="delayr"><em class="citetitle">delayr</em></a> and <a class="link" href="delayw.html" title="delayw"><em class="citetitle">delayw</em></a> opcodes in conjunction with the <span class="emphasis"><em>filter2</em></span> opcode. </p> </div> <div class="refsect1" title="Examples"> <a id="id2850250"></a> <h2>Examples</h2> <p> A first-order linear-phase lowpass FIR filter operating on a k-rate signal: </p> <div class="informalexample"> <pre class="programlisting"> k1 <span class="opc">filter2</span> ksig, 2, 0, 0.5, 0.5 <span class="comment">;; k-rate FIR filter</span></pre> </div> <p> </p> </div> <div class="refsect1" title="See Also"> <a id="id2850281"></a> <h2>See Also</h2> <p> <a class="link" href="zfilter2.html" title="zfilter2"><em class="citetitle">zfilter2</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="id2850299"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: Michael A. Casey</td> </tr> <tr> <td>M.I.T.</td> </tr> <tr> <td>Cambridge, Mass.</td> </tr> <tr> <td>1997</td> </tr> </table> <p> </p> <p>New in version 3.47</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="filevalid.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="fin.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">filevalid </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> fin</td> </tr> </table> </div> </body> </html>