<?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>pareq</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="pan.html" title="pan" /> <link rel="next" href="partials.html" title="partials" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">pareq</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="pan.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="partials.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="pareq"> <a id="pareq"></a> <div class="titlepage"></div> <a id="IndexPareq" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">pareq</span> </h2> <p>pareq — Implementation of Zoelzer's parametric equalizer filters. </p> </div> <div class="refsect1" title="Description"> <a id="idp35237120"></a> <h2>Description</h2> <p> Implementation of Zoelzer's parametric equalizer filters, with some modifications by the author. </p> <p> The formula for the low shelf filter is: </p> <div class="literallayout"> <p><br /> omega = 2*pi*f/sr<br /> K = tan(omega/2)<br /> <br /> b0 = 1 + sqrt(2*V)*K + V*K^2<br /> b1 = 2*(V*K^2 - 1)<br /> b2 = 1 - sqrt(2*V)*K + V*K^2<br /> <br /> a0 = 1 + K/Q + K^2<br /> a1 = 2*(K^2 - 1)<br /> a2 = 1 - K/Q + K^2<br /> </p> </div> <p> </p> <p> The formula for the high shelf filter is: </p> <div class="literallayout"> <p><br /> omega = 2*pi*f/sr<br /> K = tan((pi-omega)/2)<br /> <br /> b0 = 1 + sqrt(2*V)*K + V*K^2<br /> b1 = -2*(V*K^2 - 1)<br /> b1 = 1 - sqrt(2*V)*K + V*K^2<br /> <br /> a0 = 1 + K/Q + K^2<br /> a1 = -2*(K^2 - 1)<br /> a2 = 1 - K/Q + K^2<br /> </p> </div> <p> </p> <p> The formula for the peaking filter is: </p> <div class="literallayout"> <p><br /> omega = 2*pi*f/sr<br /> K = tan(omega/2)<br /> <br /> b0 = 1 + V*K/2 + K^2<br /> b1 = 2*(K^2 - 1)<br /> b2 = 1 - V*K/2 + K^2<br /> <br /> a0 = 1 + K/Q + K^2<br /> a1 = 2*(K^2 - 1)<br /> a2 = 1 - K/Q + K^2<br /> </p> </div> <p> </p> </div> <div class="refsect1" title="Syntax"> <a id="idp35250128"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>pareq</strong></span> asig, kc, kv, kq [, imode] [, iskip]</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp35251288"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>imode</em></span> (optional, default: 0) -- operating mode </p> <div class="itemizedlist"> <ul class="itemizedlist" type="disc"> <li class="listitem"> <p>0 = Peaking</p> </li> <li class="listitem"> <p>1 = Low Shelving</p> </li> <li class="listitem"> <p>2 = High Shelving</p> </li> </ul> </div> <p> </p> <p> <span class="emphasis"><em>iskip</em></span> (optional, default=0) -- if non zero skip the initialisation of the filter. (New in Csound version 4.23f13 and 5.0) </p> </div> <div class="refsect1" title="Performance"> <a id="idp35337184"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kc</em></span> -- center frequency in peaking mode, corner frequency in shelving mode. </p> <p> <span class="emphasis"><em>kv</em></span> -- amount of boost or cut. A value less than 1 is a cut. A value greater than 1 is a boost. A value of 1 is a flat response. </p> <p> <span class="emphasis"><em>kq</em></span> -- Q of the filter (sqrt(.5) is no resonance) </p> <p> <span class="emphasis"><em>asig</em></span> -- the incoming signal </p> </div> <div class="refsect1" title="Examples"> <a id="idp35339808"></a> <h2>Examples</h2> <p> Here is an example of the pareq opcode. It uses the file <a class="ulink" href="examples/pareq.csd" target="_top"><em class="citetitle">pareq.csd</em></a>. </p> <div class="example"> <a id="idp35340728"></a> <p class="title"> <strong>Example 565. Example of the pareq 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> <span class="comment">; Audio out Audio in No messages</span> -odac -iadc -d <span class="comment">;;;RT audio I/O</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o pareq.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">kr</span> <span class="op">=</span> 4410 <span class="ohdr">ksmps</span> <span class="op">=</span> 10 <span class="ohdr">nchnls</span> <span class="op">=</span> 2 <span class="oblock">instr</span> 15 ifc <span class="op">=</span> p4 <span class="comment">; Center / Shelf</span> kq <span class="op">=</span> p5 <span class="comment">; Quality factor sqrt(.5) is no resonance</span> kv <span class="op">=</span> <span class="opc">ampdb</span>(p6) <span class="comment">; Volume Boost/Cut</span> imode <span class="op">=</span> p7 <span class="comment">; Mode 0=Peaking EQ, 1=Low Shelf, 2=High Shelf</span> kfc <span class="opc">linseg</span> ifc<span class="op">*</span>2, p3, ifc<span class="op">/</span>2 asig <span class="opc">rand</span> 5000 <span class="comment">; Random number source for testing</span> aout <span class="opc">pareq</span> asig, kfc, kv, kq, imode <span class="comment">; Parmetric equalization</span> <span class="opc">outs</span> aout, aout <span class="comment">; Output the results</span> <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="comment">; SCORE:</span> <span class="comment">; Sta Dur Fcenter Q Boost/Cut(dB) Mode</span> <span class="stamnt">i</span>15 0 1 10000 .2 12 1 <span class="stamnt">i</span>15 + . 5000 .2 12 1 <span class="stamnt">i</span>15 . . 1000 .707 -12 2 <span class="stamnt">i</span>15 . . 5000 .1 -12 0 <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="idp35343032"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Hans Mikelson</td> </tr> <tr> <td>December 1998</td> </tr> </table> <p> </p> <p>New in Csound version 3.50</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="pan.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="partials.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">pan </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> partials</td> </tr> </table> </div> </body> </html>