File: filter2.html

package info (click to toggle)
csound-doc 3.47b2-2
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 1,492 kB
  • ctags: 272
  • sloc: makefile: 36
file content (115 lines) | stat: -rw-r--r-- 5,347 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<HTML>
<TITLE>FILTER2</TITLE>
<CENTER><A NAME="filter2"></A>
<HR><B><A HREF="../REFER.html">QUICK-REF</A></B> - <B><A HREF="../TITLE.html"><FONT SIZE=+1>C</FONT>soundManual</A></B>
- <B><A HREF="./SIG_MOD.html">Top of this section</A></B> - <A HREF="./nlfilt.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="./lpread.html">Next</A>&nbsp;
<HR></CENTER>

<H2>
filter2, kfilter2, zfilter2</H2>
<TT>&nbsp;&nbsp;&nbsp; a1&nbsp; <B>filter2</B>&nbsp;&nbsp; asig, iM,iN,ib0,ib1,...,
ibM,ia1,ia2,...,iaN</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; k1&nbsp; <B>kfilter2</B>&nbsp; ksig, iM,iN,ib0,ib1,...,ibM,ia1,ia2,...,iaN</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; a1&nbsp; <B>zfilter2</B>&nbsp; asig, kdamp,kfreq,iM,iN,ib0,ib1,...,ibM,ia1,ia2,...,iaN</TT>

<P>
<HR>
<BR>&nbsp;
<H4>
<U>DESCRIPTION</U></H4>
General purpose custom filter with time-varying pole control. The filter
coefficients implement the following difference equation:

<P>&nbsp;<TT> (1)*y(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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
A(Z)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp; + a1*Z&nbsp;&nbsp;&nbsp;
+ ... + aN*Z</TT>
<BR>&nbsp;

<P><B><U>INITIALIZATION</U></B>

<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 <B>gen01</B>. With <B>zfilter2,</B>
the roots of the characteristic polynomials are solved at initialization
so that the pole-control operations can be implemented efficiently.
<BR>&nbsp;

<P><B><U>PERFORMANCE</U></B>

<P>The<B> filter2</B> and <B>kfilter2</B> opcodes perform filtering using
a transposed form-II digital filter lattice with no time-varying control.
<B>zfilter2</B> uses the additional operations of radial pole-shearing
and angular pole-warping in the Z plane.

<P>Pole shearing increases the magnitude of poles along radial lines in
the Z-plane. This has the affect of altering filter ring times. The k-rate
variable <I>kdamp</I> is the damping parameter. Positive values (0.01 to
0.99) increase the ring-time of the filter (hi-Q), negative values (-0.01
to -0.99) decrease the ring-time of the filter, (lo-Q).

<P>Pole warping changes the frequency of poles by moving them along angular
paths in the Z plane. This operation leaves the shape of the magnitude
response unchanged but alters the frequencies by a constant factor (preserving
0 and p). The k-rate variable <I>kfreq</I> determines the frequency warp
factor. Positive values (0.01 to 0.99) increase frequencies toward p and
negative values (-0.01 to -0.99) decrease frequencies toward 0.

<P>Since <B>filter2</B> 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&nbsp;
using a pair of <B><A HREF="./delayr.html">delayr</A> </B>and <B><A HREF="./delayr.html">delayw
</A></B>opcodes in conjunction with the <B>filter2</B> opcode.

<P><B><U>EXAMPLE:</U></B>

<P>A first-order linear-phase lowpass linear-phase FIR filter operating
on a k-rate signal:

<P>&nbsp;<TT> k1&nbsp;&nbsp; <B>kfilter2</B> ksig, 2, 0, 0.5, 0.5&nbsp;&nbsp;
;; k-rate FIR filter</TT>

<P>A controllable second-order IIR filter operating on an a-rate signal:

<P>&nbsp;<TT> a1&nbsp;&nbsp; <B>zfilter2</B> asig, kdamp, kfreq, 1, 2,
1, ia1, ia2 ;; controllable a-rate IIR filter</TT>
<BR>&nbsp;
<H4>
<U>AUTHOR:</U></H4>
Michael A. Casey
<BR>M.I.T.
<BR>Cambridge, Mass.
<BR>1997
<BR>&nbsp;
<BR>&nbsp;
<CENTER><P>
<HR><B><A HREF="../REFER.html">QUICK-REF</A></B> - <B><A HREF="../TITLE.html"><FONT SIZE=+1>C</FONT>soundManual</A></B>
- <B><A HREF="./SIG_MOD.html">Top of this section</A></B> - <A HREF="./nlfilt.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="./lpread.html">Next</A>&nbsp;
<HR></CENTER>


<P><CENTER>
<B><I><FONT COLOR="#006600">HTML Csound Manual - <FONT SIZE=-1>&copy;
Jean Pich&eacute; &amp; Peter J. Nix, 1994-97</FONT></FONT></I></B>&nbsp;
</CENTER>
</HTML>