1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
6<title>axvpb.pb.biquad</title>
7<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
8<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 6.5.0.0 for Windows">
9<META http-equiv="Content-Style-Type" content="text/css">
10</head>
11
12<body>
13
14<h1 align="left">axvpb.pb.biquad</h1>
15
16<h2>C Specification</h2>
17
18<BLOCKQUOTE>
19<pre><CODE>
20#define AX_PB_BIQUAD_OFF        0x0000  // Biquad IIR filter switch
21#define AX_PB_BIQUAD_ON         0x0002
22
23typedef struct _AXPBBIQUAD
24{
25
26    u16     on;   // Filter switch. Valid when <CODE>AX_PB_BIQUAD_ON(2)</CODE>.  Invalid when <CODE>AX_PB_BIQUAD_OFF(0)</CODE>.
27    u16     xn1;  //  History data. Must be initialized to zero.
28    u16     xn2;  // History data. Must be initialized to zero.
29    u16     yn1;  // History data. Must be initialized to zero.
30    u16     yn2;  // History data. Must be initialized to zero.
31    u16     b0;   // Filter coefficient
32    u16     b1;   // Filter coefficient
33    u16     b2;   // Filter coefficient
34    u16     a1;   // Filter coefficient
35    u16     a2;   // Filter coefficient
36
37} AXPBBIQUAD;
38</CODE></pre>
39</BLOCKQUOTE>
40
41<h2>Description</h2>
42
43<p>With AX, a Biquad filter can be applied to each voice independently. Moreover, the Biquad filter can be used with a conventional LPF filter. The <code>biquad</code> value controls these Biquad filters.</p>
44
45<p>The <code>on</code> value is the Biquad filter switch. Biquad filters are enabled when <code>AX_PB_BIQUAD_ON(2)</code> is set to <code>on</code>.  The filters are invalid when <code>AX_PB_BIQUAD_OFF(0)</code> is set.</p>
46
47<p>The <code>xn1</code>, <code>xn2</code>, <code>yn1</code> and <code>yn2</code> values are history data used by Biquad filters. These values must be initialized to zero when Biquad filters are enabled. Once Biquad filters become valid, the AX library manages these values. After the data have been initialized, the application must not make any changes to them.</p>
48
49<p>The <code>b0</code>, <code>b1</code>, <code>b2</code>, <code>a1</code> and <code>a2</code> values are coefficients of the Biquad filter in the diagram below. The application must set the coefficients in these members to correspond to the filter type and cutoff frequency. Note that these values can be changed at any time.</p>
50
51<BLOCKQUOTE><pre><code>
52    y(n) = b0 * x(n) + b1 * x(n-1) + b2 * x(n-2) + a1 * y(n-1) + a2 * y(n-2)
53
54    IN---&gt;[+]--------------&gt;+---&gt;[ x b0 ]--&gt;[+]---&gt;OUT
55           |                |                |
56           |             [ Z^-1 ]            |
57           |                |                |
58           +&lt;---[ x a1 ]&lt;---+---&gt;[ x b1 ]---&gt;+
59           |                |                |
60           |             [ Z^-1 ]            |
61           |                |                |
62           +&lt;---[ x a1 ]&lt;---+---&gt;[ x b1 ]---&gt;+
63
64
65                    b0 + b1(Z^-1) + b2(Z^-2)
66           H(z) = ----------------------------
67                    1  - a1(Z^-1) - a2(Z^-2)
68</code></pre></BLOCKQUOTE>
69
70<p>Each filter coefficient is a 16-bit fixed-point value with a 2-bit integer part and a 14-bit decimal fraction (<code>-2.0 &lt;= <em>coef</em> &lt; 2.0</code>).</p><p>Using a general-purpose filter-design tool, convert the requested filter coefficients to fixed-point values, and set to <code>b0 - a2</code>.</p>
71
72<p>For the sample <code>/build/demos/axdemo/include/lpfdemo.h</code>, the following coefficient table has been prepared:</p>
73
74<BLOCKQUOTE><pre><CODE>
75typedef struct
76{
77    u16  b0;
78    u16  b1;
79    u16  b2;
80    u16  a1;
81    u16  a2;
82    char *text;
83
84} __BIQUAD_COEF;
85
86// low-pass
87static __BIQUAD_COEF __biquad_lpf_coefs[] =
88{
89    { 0x36fa, 0x6df4, 0x36fa, 0x8c47, 0xcaca, &quot;16000 Hz&quot;}, // actually 15000 Hz
90    { 0x2bf0, 0x57e0, 0x2bf0, 0xa967, 0xdc70, &quot;12800 Hz&quot;},
91    { 0x2071, 0x40e3, 0x2071, 0xcd87, 0xe904, &quot;10240 Hz&quot;},
92    { 0x173d, 0x2e7b, 0x173d, 0xef3d, 0xee4c, &quot; 8000 Hz&quot;},
93    { 0x110d, 0x221a, 0x110d, 0x0903, 0xeec0, &quot; 6400 Hz&quot;},
94    { 0x0c59, 0x18b3, 0x0c59, 0x1eee, 0xecbf, &quot; 5120 Hz&quot;},
95    { 0x087e, 0x10fc, 0x087e, 0x332c, 0xe8d8, &quot; 4000 Hz&quot;},
96    { 0x05f5, 0x0bea, 0x05f5, 0x423b, 0xe487, &quot; 3200 Hz&quot;},
97    { 0x041f, 0x083d, 0x041f, 0x4e96, 0xdff6, &quot; 2560 Hz&quot;},
98    { 0x02b3, 0x0565, 0x02b3, 0x598e, 0xdb05, &quot; 2000 Hz&quot;},
99    { 0x01d1, 0x03a3, 0x01d1, 0x616d, 0xd6df, &quot; 1600 Hz&quot;},
100    { 0x0137, 0x026e, 0x0137, 0x67b7, 0xd325, &quot; 1280 Hz&quot;},
101    { 0x00c5, 0x018a, 0x00c5, 0x6d2e, 0xcf90, &quot; 1000 Hz&quot;},
102    { 0x0082, 0x0103, 0x0082, 0x710d, 0xccce, &quot;  800 Hz&quot;},
103    { 0x0055, 0x00a9, 0x0055, 0x741f, 0xca7b, &quot;  640 Hz&quot;},
104    { 0x0035, 0x0069, 0x0035, 0x76c7, 0xc85a, &quot;  500 Hz&quot;},
105    { 0x0022, 0x0044, 0x0022, 0x78a9, 0xc6c7, &quot;  400 Hz&quot;},
106    { 0x0016, 0x002c, 0x0016, 0x7a27, 0xc57c, &quot;  320 Hz&quot;},
107    { 0x000e, 0x001d, 0x000e, 0x7b57, 0xc46d, &quot;  256 Hz&quot;},
108    { 0x0009, 0x0012, 0x0009, 0x7c5f, 0xc37c, &quot;  200 Hz&quot;},
109    { 0x0006, 0x000b, 0x0006, 0x7d1b, 0xc2ce, &quot;  160 Hz&quot;},
110    { 0x0004, 0x0007, 0x0004, 0x7db0, 0xc241, &quot;  128 Hz&quot;},
111    { 0x0002, 0x0004, 0x0002, 0x7e32, 0xc1c5, &quot;  100 Hz&quot;},
112    { 0x0001, 0x0003, 0x0001, 0x7e8f, 0xc16b, &quot;   80 Hz&quot;}
113};
114
115// high-pass
116static __BIQUAD_COEF __biquad_hpf_coefs[] =
117{
118    { 0x3bf9, 0x880e, 0x3bf9, 0x7f0d, 0xc0f1, &quot;   80 Hz&quot;},
119    { 0x3bdd, 0x8846, 0x3bdd, 0x7ed0, 0xc12c, &quot;  100 Hz&quot;},
120    { 0x3bb5, 0x8896, 0x3bb5, 0x7e7b, 0xc17f, &quot;  128 Hz&quot;},
121    { 0x3b88, 0x88f1, 0x3b88, 0x7e19, 0xc1dd, &quot;  160 Hz&quot;},
122    { 0x3b4f, 0x8962, 0x3b4f, 0x7d9e, 0xc252, &quot;  200 Hz&quot;},
123    { 0x3b00, 0x8a00, 0x3b00, 0x7cf1, 0xc2f5, &quot;  256 Hz&quot;},
124    { 0x3aa6, 0x8ab4, 0x3aa6, 0x7c2b, 0xc3ac, &quot;  320 Hz&quot;},
125    { 0x3a36, 0x8b95, 0x3a36, 0x7b31, 0xc48f, &quot;  400 Hz&quot;},
126    { 0x39aa, 0x8cac, 0x39aa, 0x79f8, 0xc5a5, &quot;  500 Hz&quot;},
127    { 0x38e8, 0x8e31, 0x38e8, 0x783d, 0xc722, &quot;  640 Hz&quot;},
128    { 0x380b, 0x8fea, 0x380b, 0x763e, 0xc8ca, &quot;  800 Hz&quot;},
129    { 0x36fa, 0x920c, 0x36fa, 0x73b9, 0xcaca, &quot; 1000 Hz&quot;},
130    { 0x3580, 0x9500, 0x3580, 0x7027, 0xcd77, &quot; 1280 Hz&quot;},
131    { 0x33d7, 0x9852, 0x33d7, 0x6c03, 0xd05c, &quot; 1600 Hz&quot;},
132    { 0x31ce, 0x9c64, 0x31ce, 0x66c2, 0xd3bc, &quot; 2000 Hz&quot;},
133    { 0x2f06, 0xa1f5, 0x2f06, 0x5f4a, 0xd80d, &quot; 2560 Hz&quot;},
134    { 0x2bf0, 0xa821, 0x2bf0, 0x569a, 0xdc70, &quot; 3200 Hz&quot;},
135    { 0x2836, 0xaf95, 0x2836, 0x4b8b, 0xe12e, &quot; 4000 Hz&quot;},
136    { 0x2334, 0xb998, 0x2334, 0x3bb7, 0xe68e, &quot; 5120 Hz&quot;},
137    { 0x1dbf, 0xc483, 0x1dbf, 0x2913, 0xeb0d, &quot; 6400 Hz&quot;},
138    { 0x173d, 0xd186, 0x173d, 0x10c3, 0xee4c, &quot; 8000 Hz&quot;},
139    { 0x0eab, 0xe2ab, 0x0eab, 0xec30, 0xee0b, &quot;10240 Hz&quot;},
140    { 0x05f5, 0xf416, 0x05f5, 0xbdc5, 0xe487, &quot;12800 Hz&quot;},
141    { 0x00c5, 0xfe77, 0x00c5, 0x92d2, 0xcf90, &quot;16000 Hz&quot;}  // actually 15000 Hz
142};
143
144// band-pass
145static __BIQUAD_COEF __biquad_bpf_coefs[] =
146{
147    { 0x3ff5, 0x0000, 0xc00c, 0x0000, 0x3fea, &quot;   0 - 16000 Hz&quot;},
148    { 0x3c9d, 0x0000, 0xc364, 0x061c, 0x393a, &quot;  80 - 14464 Hz&quot;},
149    { 0x398b, 0x0000, 0xc676, 0x0c2a, 0x3315, &quot;  95 - 12928 Hz&quot;},
150    { 0x36c4, 0x0000, 0xc93d, 0x11b5, 0x2d88, &quot; 101 - 11520 Hz&quot;},
151    { 0x3427, 0x0000, 0xcbd9, 0x16e1, 0x284e, &quot; 113 - 10240 Hz&quot;},
152    { 0x31cc, 0x0000, 0xce35, 0x1b88, 0x2398, &quot; 127 -  9152 Hz&quot;},
153    { 0x2f65, 0x0000, 0xd09b, 0x2044, 0x1eca, &quot; 143 -  8128 Hz&quot;},
154    { 0x2d16, 0x0000, 0xd2eb, 0x24d3, 0x1a2b, &quot; 160 -  7232 Hz&quot;},
155    { 0x2ae2, 0x0000, 0xd51f, 0x2927, 0x15c3, &quot; 180 -  6464 Hz&quot;},
156    { 0x28a0, 0x0000, 0xd760, 0x2d96, 0x1141, &quot; 202 -  5760 Hz&quot;},
157    { 0x2652, 0x0000, 0xd9af, 0x3220, 0x0ca3, &quot; 226 -  5120 Hz&quot;},
158    { 0x2418, 0x0000, 0xdbe9, 0x367d, 0x082f, &quot; 254 -  4576 Hz&quot;},
159    { 0x21b7, 0x0000, 0xde49, 0x3b26, 0x036f, &quot; 286 -  4064 Hz&quot;},
160    { 0x1f59, 0x0000, 0xe0a7, 0x3fcd, 0xfeb3, &quot; 320 -  3616 Hz&quot;},
161    { 0x1d03, 0x0000, 0xe2fd, 0x445e, 0xfa07, &quot; 360 -  3232 Hz&quot;},
162    { 0x1a92, 0x0000, 0xe56e, 0x4927, 0xf525, &quot; 404 -  2880 Hz&quot;},
163    { 0x1807, 0x0000, 0xe7fa, 0x4e25, 0xf00e, &quot; 452 -  2560 Hz&quot;},
164    { 0x157d, 0x0000, 0xea84, 0x531c, 0xeafa, &quot; 508 -  2288 Hz&quot;},
165    { 0x12b6, 0x0000, 0xed4a, 0x588a, 0xe56d, &quot; 572 -  2032 Hz&quot;},
166    { 0x0fdf, 0x0000, 0xf022, 0x5e1d, 0xdfbe, &quot; 640 -  1808 Hz&quot;},
167    { 0x1807, 0x0000, 0xe7fa, 0x4e25, 0xf00e, &quot; 720 -  1616 Hz&quot;},
168    { 0x09aa, 0x0000, 0xf657, 0x6a3e, 0xd354, &quot; 808 -  1440 Hz&quot;},
169    { 0x061f, 0x0000, 0xf9e2, 0x7130, 0xcc3e, &quot; 904 -  1280 Hz&quot;},
170    { 0x0239, 0x0000, 0xfdc8, 0x78cc, 0xc472, &quot;1016 -  1144 Hz&quot;}
171};
172</CODE></pre></BLOCKQUOTE>
173
174<p>To reflect the changes to the filter coefficients <code>b0 ~ a2</code> in the DSP, the application must assert the <CODE>AX_SYNC_USER_BIAQUAD_COEF</CODE> bit in the <CODE>axvpb.sync</CODE> member. If the Biquad filer switch <code>on</code> value is changed and the overall <code>AXPBBIQUAD</code> structure needs to be reflected in the DSP, the application must assert the <code>AX_SYNC_USER_BIQUAD</code> bit.</p>
175
176<p><strong>Note: If an extremely small value is set for a filter coefficient (for example, <code>__biquad_lpf_coefs[]</code> of 80Hz in the above sample), some sounds may exhibit noticeable pop.</strong></p>
177
178<p><strong>Note: The load that the Biquad filters place on the DSP is three times greater than with conventional LPF filters. The load is about the same as a mixer with one AUX bus.</strong></p>
179
180<h2>See Also</h2>
181
182<p>
183<font face="Courier New"><a href="../Voice_Parameter_Blocks/sync.html">axvpb.sync</a><br> <a href="../Voice_Parameters/AXSetVoiceBiquad.html">AXSetVoiceBiquad</a><br> <a href="../Voice_Parameters/AXSetVoiceBiquadCoefs.html">AXSetVoiceBiquadCoefs</a></font>
184</p>
185
186<h2>Revision History</h2>
187
188<P>
1892006/11/14 Initial version.
190</P>
191<hr>
192<P>CONFIDENTIAL</p>
193</BODY>
194</HTML>
195
196