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.lpf</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.lpf</h1> 15 16<h2>C Specification</h2> 17 18<BLOCKQUOTE> 19<pre><CODE> 20#define AX_PB_LPF_OFF 0x0000 // LPF switch 21#define AX_PB_LPF_ON 0x0001 22 23typedef struct _AXPBLPF 24{ 25 u16 on; // Filter is enabled when AX_PB_LPF_ON(1). Filter is invalid when AX_PB_LPF_OFF(0). 26 u16 yn1; // history sample. Must be initialized once to zero. 27 u16 a0; // Coefficient 28 u16 b0; // Coefficient 29 30 31} AXPBLPF; 32</CODE></pre> 33</BLOCKQUOTE> 34 35<h2>Description</h2> 36 37<p>The <code>lpf</code> values are used by the DSP to implement a low-pass filter on each voice independently.</p> 38 39<p>The <code>on</code> value is a switch for the filter process on the specified voice. LPF is valid when <code>AX_PB_LPF_ON(1)</code> is set to <code>on</code>. LPF is invalid when <code>AX_PB_LPF_OFF(0)</code> is set.</p> 40 41<p>The <code>yn1</code> value is a history value and must be initialized to zero. This value is thereafter maintained by AX and must not be touched.</p> 42 43<p>The <code>a0</code> and <code>b0</code> values are the coefficients for the filter, and must be provided by the application. These values determine the cut-off frequency of the filter, and may be changed at any time.</p> 44 45<p>The filter is a simple one-pole function:</p> 46 47<BLOCKQUOTE> 48<pre><CODE>y(n) = a0*x(n) - b0*y(n-1)</CODE></pre> 49</BLOCKQUOTE> 50 51<p>When <code>x(n)</code> is the current <code><i>input</i></code> sample, and <code>y(n-1)</code> is the previous <code><i>output</i></code> sample, the coefficients <code>a0</code> and <code>b0</code> can be calculated as follows:</p> 52 53<BLOCKQUOTE> 54<pre>c = 2.0 - cos(2.0*pi*freq/32000.0)<br> b0 = sqrt(c^2 - 1) - c<br> a0 = 1 + b0</pre> 55</BLOCKQUOTE> 56 57<p>Where <code>freq</code> is in Hertz (Hz) and must be within the range:</p> 58 59<BLOCKQUOTE> 60<pre><CODE>0 <= freq <= 16,000</CODE></pre> 61</BLOCKQUOTE> 62 63<p>The coefficients must be unsigned, 16-bit words in fixed-point format, having 1 bit of integer and 15 bits of fraction. Furthermore, the <code>b0</code> term must be (arithmetically) negated before being sent to the DSP. This is because of an optimization in the DSP filter calculation provided by the absence of a sign bit in the coefficients.</p> 64 65<p>A sample table of coefficients is provided below:</p> 66 67<BLOCKQUOTE> 68 69<pre><CODE>static u16 __lpf_coefs[48] = 70{ 71 72// a0 b0 cut-off frequency 73 //------ ------ ----------------- 74 0x6a09, 0x15f6, // 16000Hz 75 0x6871, 0x178e, // 12800Hz 76 0x6463, 0x1b9c, // 10240Hz 77 0x5db3, 0x224c, // 8000Hz 78 0x5618, 0x29e7, // 6400Hz 79 0x4d7a, 0x3285, // 5120Hz 80 0x4367, 0x3c98, // 4000Hz 81 0x3a5a, 0x45a5, // 3200Hz 82 0x31c5, 0x4e3a, // 2560Hz 83 0x2924, 0x56db, // 2000Hz 84 0x2244, 0x5dbb, // 1600Hz 85 0x1c50, 0x63af, // 1280Hz 86 0x16c0, 0x693f, // 1000Hz 87 0x1292, 0x6d6d, // 800Hz 88 0x0f18, 0x70e7, // 640Hz 89 0x0bf5, 0x740a, // 500Hz 90 0x09a9, 0x7656, // 400Hz 91 0x07ca, 0x7835, // 320Hz 92 0x0646, 0x79b9, // 256Hz 93 0x04ed, 0x7b12, // 200Hz 94 0x03f5, 0x7c0a, // 160Hz 95 0x032d, 0x7cd2, // 128Hz 96 0x027d, 0x7d82, // 100Hz 97 0x01fe, 0x7e01 // 80Hz 98}; </CODE></pre> 99</BLOCKQUOTE> 100 101<p>Note: The table above provides cut-off frequencies from 80Hz to 16,000Hz, in (approximately) 1/3 octave steps. This granularity is sufficient to achieve a smooth 'sweep' of the cut-off frequency across the spectrum.</p> 102 103<p>This filter provides 6dB of attenuation per octave.</p> 104 105<P>Use <CODE><A href="../Utility/AXGetLpfCoefs.html">AXGetLpfCoefs()</A></CODE> to get the coefficients of the specified cut-off frequency.</P> 106 107<P>To reflect changes to <code>a0</code> or <code>b0</code> in the DSP, assert the <code>AX_SYNC_USER_LPF_COEF</code> bit in the <code>axvpb.sync</code> WORD.</P> 108 109<P>To synchronize the entire structure, assert the <code>AX_SYNC_USER_LPF</code> bit.</P> 110 111<h2>See Also</h2> 112 113<p> 114<font face="Courier New"><a href="../Voice_Parameter_Blocks/sync.html">axvpb.sync</a><br> <a href="../Voice_Parameters/AXSetVoiceLpf.html">AXSetVoiceLpf</a><br> <a href="../Voice_Parameters/AXSetVoiceLpfCoefs.html">AXSetVoiceLpfCoefs</a><br> <a href="../Utility/AXGetLpfCoefs.html">AXGetLpfCoefs</a><br></font> 115</p> 116 117<h2>Revision History</h2> 118 119<P> 1202006/11/14 Added macro.<br>2006/03/01 Initial version. 121</P> 122<hr> 123<P>CONFIDENTIAL</p> 124</BODY> 125</HTML> 126 127