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>Syntax</h2> 17<dl><dd><pre class="construction"> 18#define AX_PB_LPF_OFF 0x0000 // LPF switch 19#define AX_PB_LPF_ON 0x0001 20 21typedef struct _AXPBLPF 22{ 23 u16 on; // Filter is enabled when AX_PB_LPF_ON(1). Filter is invalid when AX_PB_LPF_OFF(0). 24 u16 yn1; // history sample. Must be initialized once to zero. 25 u16 a0; // Coefficient 26 u16 b0; // Coefficient 27 28 29} AXPBLPF; 30</pre></dd></dl> 31 32<h2>Description</h2> 33<p>The <SPAN class="argument">lpf</SPAN> values are used by the DSP to implement a low-pass filter (LPF) on each voice independently.</p> 34 35<p>The <SPAN class="argument">on</SPAN> value is a switch for the filter process on the specified voice. LPF is enabled when <code>AX_PB_LPF_ON(1)</code> is set to <SPAN class="argument">on</SPAN>. LPF is disabled when <code>AX_PB_LPF_OFF(0)</code> is set.</p> 36 37<p>The <SPAN class="argument">yn1</SPAN> value is a history value and must be initialized to zero. This value is thereafter maintained by AX and must not be touched.</p> 38 39<p>The <SPAN class="argument">a0</SPAN> and <SPAN class="argument">b0</SPAN> 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> 40 41<p>The filter is a simple one-pole function:</p> 42 43<BLOCKQUOTE> 44<pre><CODE>y(n) = a0*x(n) - b0*y(n-1)</CODE></pre> 45</BLOCKQUOTE> 46 47<p>Here, <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 <SPAN class="argument">a0</SPAN> and <SPAN class="argument">b0</SPAN> can be calculated as follows:</p> 48 49<BLOCKQUOTE> 50<pre>c = 2.0 - cos(2.0*pi*freq/32000.0)<br> b0 = sqrt(c^2 - 1) - c<br> a0 = 1 + b0</pre> 51</BLOCKQUOTE> 52 53<p>Where <code>freq</code> is in Hertz (Hz) and must be within the range:</p> 54 55<BLOCKQUOTE> 56<pre><CODE>0 <= freq <= 16,000</CODE></pre> 57</BLOCKQUOTE> 58 59<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 <SPAN class="argument">b0</SPAN> 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> 60 61<p>A sample table of coefficients is provided below:</p> 62 63<BLOCKQUOTE> 64 65<pre><CODE>static u16 __lpf_coefs[48] = 66{ 67 68 // a0 b0 cut-off frequency 69 //------ ------ ----------------- 70 0x6a09, 0x15f6, // 16000Hz 71 0x6871, 0x178e, // 12800Hz 72 0x6463, 0x1b9c, // 10240Hz 73 0x5db3, 0x224c, // 8000Hz 74 0x5618, 0x29e7, // 6400Hz 75 0x4d7a, 0x3285, // 5120Hz 76 0x4367, 0x3c98, // 4000Hz 77 0x3a5a, 0x45a5, // 3200Hz 78 0x31c5, 0x4e3a, // 2560Hz 79 0x2924, 0x56db, // 2000Hz 80 0x2244, 0x5dbb, // 1600Hz 81 0x1c50, 0x63af, // 1280Hz 82 0x16c0, 0x693f, // 1000Hz 83 0x1292, 0x6d6d, // 800Hz 84 0x0f18, 0x70e7, // 640Hz 85 0x0bf5, 0x740a, // 500Hz 86 0x09a9, 0x7656, // 400Hz 87 0x07ca, 0x7835, // 320Hz 88 0x0646, 0x79b9, // 256Hz 89 0x04ed, 0x7b12, // 200Hz 90 0x03f5, 0x7c0a, // 160Hz 91 0x032d, 0x7cd2, // 128Hz 92 0x027d, 0x7d82, // 100Hz 93 0x01fe, 0x7e01 // 80Hz 94}; </CODE></pre> 95</BLOCKQUOTE> 96 97<p>Notice that 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> 98 99<p>This filter provides 6dB of attenuation per octave.</p> 100 101<P>Use the <A href="../Utility/AXGetLpfCoefs.html"><CODE>AXGetLpfCoefs</CODE></A> function to get the coefficients of the specified cut-off frequency.</P> 102 103<P>To apply changes to <SPAN class="argument">a0</SPAN> or <SPAN class="argument">b0</SPAN> in the DSP, the application must assert the <CODE>AX_SYNC_USER_LPF_COEF</CODE> bit in the <CODE>axvpb.sync</CODE> member.</P> 104 105<P>To synchronize the entire structure, assert the <code>AX_SYNC_USER_LPF</code> bit.</P> 106 107<h2>See Also</h2> 108<p class="reference"> 109<a href="../Voice_Parameter_Blocks/sync.html">axvpb.sync</a>, <a href="../Voice_Parameters/AXSetVoiceLpf.html">AXSetVoiceLpf</a>, <a href="../Voice_Parameters/AXSetVoiceLpfCoefs.html">AXSetVoiceLpfCoefs</a>, <a href="../Utility/AXGetLpfCoefs.html">AXGetLpfCoefs</a> 110</p> 111 112<h2>Revision History</h2> 113<P> 1142006/11/14 Added macro.<br>2006/03/01 Initial version.<BR> 115</P> 116 117<hr><p>CONFIDENTIAL</p></body> 118</html> 119 120