| 1 | |
| 2 | <refentry id="pareq"> |
| 3 | <indexterm id="IndexPareq"><primary>pareq</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Specialized Filters</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>pareq</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>pareq</refname> |
| 13 | <refpurpose> |
| 14 | Implementation of Zoelzer's parametric equalizer filters. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | Implementation of Zoelzer's parametric equalizer filters, with some modifications by the author. |
| 22 | </para> |
| 23 | |
| 24 | <para> |
| 25 | The formula for the low shelf filter is: |
| 26 | <literallayout> |
| 27 | omega = 2*pi*f/sr |
| 28 | K = tan(omega/2) |
| 29 | |
| 30 | b0 = 1 + sqrt(2*V)*K + V*K^2 |
| 31 | b1 = 2*(V*K^2 - 1) |
| 32 | b2 = 1 - sqrt(2*V)*K + V*K^2 |
| 33 | |
| 34 | a0 = 1 + K/Q + K^2 |
| 35 | a1 = 2*(K^2 - 1) |
| 36 | a2 = 1 - K/Q + K^2 |
| 37 | </literallayout> |
| 38 | </para> |
| 39 | |
| 40 | <para> |
| 41 | The formula for the high shelf filter is: |
| 42 | <literallayout> |
| 43 | omega = 2*pi*f/sr |
| 44 | K = tan((pi-omega)/2) |
| 45 | |
| 46 | b0 = 1 + sqrt(2*V)*K + V*K^2 |
| 47 | b1 = -2*(V*K^2 - 1) |
| 48 | b1 = 1 - sqrt(2*V)*K + V*K^2 |
| 49 | |
| 50 | a0 = 1 + K/Q + K^2 |
| 51 | a1 = -2*(K^2 - 1) |
| 52 | a2 = 1 - K/Q + K^2 |
| 53 | </literallayout> |
| 54 | </para> |
| 55 | |
| 56 | <para> |
| 57 | The formula for the peaking filter is: |
| 58 | <literallayout> |
| 59 | omega = 2*pi*f/sr |
| 60 | K = tan(omega/2) |
| 61 | |
| 62 | b0 = 1 + V*K/2 + K^2 |
| 63 | b1 = 2*(K^2 - 1) |
| 64 | b2 = 1 - V*K/2 + K^2 |
| 65 | |
| 66 | a0 = 1 + K/Q + K^2 |
| 67 | a1 = 2*(K^2 - 1) |
| 68 | a2 = 1 - K/Q + K^2 |
| 69 | </literallayout> |
| 70 | </para> |
| 71 | </refsect1> |
| 72 | |
| 73 | <refsect1> |
| 74 | <title>Syntax</title> |
| 75 | <synopsis>ares <command>pareq</command> asig, kc, kv, kq [, imode] [, iskip]</synopsis> |
| 76 | </refsect1> |
| 77 | |
| 78 | <refsect1> |
| 79 | <title>Initialization</title> |
| 80 | <para> |
| 81 | <emphasis>imode</emphasis> (optional, default: 0) -- operating mode |
| 82 | <itemizedlist> |
| 83 | <listitem> |
| 84 | <para>0 = Peaking</para> |
| 85 | </listitem> |
| 86 | |
| 87 | <listitem> |
| 88 | <para>1 = Low Shelving</para> |
| 89 | </listitem> |
| 90 | |
| 91 | <listitem> |
| 92 | <para>2 = High Shelving</para> |
| 93 | </listitem> |
| 94 | </itemizedlist> |
| 95 | </para> |
| 96 | <para> |
| 97 | <emphasis>iskip</emphasis> (optional, default=0) -- if non zero |
| 98 | skip the initialisation of the filter. (New in Csound version |
| 99 | 4.23f13 and 5.0) |
| 100 | </para> |
| 101 | </refsect1> |
| 102 | |
| 103 | <refsect1> |
| 104 | <title>Performance</title> |
| 105 | <para> |
| 106 | <emphasis>kc</emphasis> -- center frequency in peaking mode, corner frequency in shelving mode. |
| 107 | </para> |
| 108 | |
| 109 | <para> |
| 110 | <emphasis>kv</emphasis> -- 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. |
| 111 | </para> |
| 112 | |
| 113 | <para> |
| 114 | <emphasis>kq</emphasis> -- Q of the filter (sqrt(.5) is no resonance) |
| 115 | </para> |
| 116 | |
| 117 | <para> |
| 118 | <emphasis>asig</emphasis> -- the incoming signal |
| 119 | </para> |
| 120 | </refsect1> |
| 121 | |
| 122 | <refsect1> |
| 123 | <title>Examples</title> |
| 124 | <para> |
| 125 | Here is an example of the pareq opcode. It uses the file <ulink url="examples/pareq.csd"><citetitle>pareq.csd</citetitle></ulink>. |
| 126 | |
| 127 | <example> |
| 128 | <title>Example of the pareq opcode.</title> |
| 129 | |
| 130 | |
| 131 | |
| 132 | <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> |
| 133 | <xi:include href="examples-xml/pareq.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 134 | </example> |
| 135 | </para> |
| 136 | </refsect1> |
| 137 | |
| 138 | <refsect1> |
| 139 | <title>See also</title> |
| 140 | <para><link linkend="SigmodSpeciali"><citetitle>Specialized Filters: Parametric EQ</citetitle></link></para> |
| 141 | </refsect1> |
| 142 | |
| 143 | <refsect1> |
| 144 | <title>Credits</title> |
| 145 | <para> |
| 146 | <simplelist> |
| 147 | <member>&namehans;</member> |
| 148 | <member>December 1998</member> |
| 149 | </simplelist> |
| 150 | </para> |
| 151 | |
| 152 | <para>New in Csound version 3.50</para> |
| 153 | </refsect1> |
| 154 | </refentry> |