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 17<h2>C Specification</h2> 18<BLOCKQUOTE> 19<pre><CODE>typedef struct _AXPBLPF 20{ 21u16 on; // 1=filter is active, 0=filter is off 22u16 yn1; // history sample. Must be initialized once to zero. 23u16 a0; // Coefficient 24u16 b0; // Coefficient 25 26 27} AXPBLPF;</CODE></pre> 28</BLOCKQUOTE> 29<h2>Description</h2> 30<p>The <code>lpf</code> values are used by the DSP to implement a per-voice, low-pass filter.</p> 31<p>The on value indicates whether filtering is active for the given voice. A value of 1 means that the filter is on, and a value of zero means that the filter is off.</p> 32<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> 33<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> 34<p>The filter is a simple one-pole function:</p> 35<BLOCKQUOTE> 36<pre><CODE>y(n) = a0*x(n) - b0*y(n-1)</CODE></pre> 37</BLOCKQUOTE> 38<p>Where<code> x(n)</code> is the current <i>input</i> sample, and <code>y(n-1)</code> is the previous <i>output</i> sample. The coefficients <code>a0</code> and <code>b0</code> can be calculated like so:</p> 39<BLOCKQUOTE> 40<pre>c = 2.0 - cos(2.0*pi*freq/32000.0)<br> b0 = sqrt(c^2 - 1) - c<br> a0 = 1 + b0</pre> 41</BLOCKQUOTE> 42<p>Where <code>freq</code> is in Hertz (Hz) and must be within the range:</p> 43<BLOCKQUOTE> 44<pre><CODE>0 <= freq <= 16,000</CODE></pre> 45</BLOCKQUOTE> 46<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 that is afforded by the absence of a sign bit in the coefficients.</p> 47<p>A sample table of coefficients is provided below:</p> 48<BLOCKQUOTE> 49<pre><CODE>static u16 __lpf_coefs[48] = 50{ 51 52// a0 b0 cut-off frequency 53 //------ ------ ----------------- 540x6a09, 0x15f6, // 16000Hz 550x6871, 0x178e, // 12800Hz 560x6463, 0x1b9c, // 10240Hz 570x5db3, 0x224c, // 8000Hz 580x5618, 0x29e7, // 6400Hz 590x4d7a, 0x3285, // 5120Hz 600x4367, 0x3c98, // 4000Hz 610x3a5a, 0x45a5, // 3200Hz 620x31c5, 0x4e3a, // 2560Hz 630x2924, 0x56db, // 2000Hz 640x2244, 0x5dbb, // 1600Hz 650x1c50, 0x63af, // 1280Hz 660x16c0, 0x693f, // 1000Hz 670x1292, 0x6d6d, // 800Hz 680x0f18, 0x70e7, // 640Hz 690x0bf5, 0x740a, // 500Hz 700x09a9, 0x7656, // 400Hz 710x07ca, 0x7835, // 320Hz 720x0646, 0x79b9, // 256Hz 730x04ed, 0x7b12, // 200Hz 740x03f5, 0x7c0a, // 160Hz 750x032d, 0x7cd2, // 128Hz 760x027d, 0x7d82, // 100Hz 770x01fe, 0x7e01 // 80Hz 78}; </CODE></pre> 79</BLOCKQUOTE> 80<p><B>Note:</B> 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> 81<p>This filter provides 6dB of attenuation per octave.</p> 82<P>Use <CODE><A href="../Utility/AXGetLpfCoefs.html">AXGetLpfCoefs()</A></CODE> to get the coefficients of the specified cut-off frequency.</P> 83<P>To reflect changes to <code>a0</code>, or <code>b0</code> in the DSP, the user must assert the <code>AX_SYNC_USER_LPF_COEF</code> bit in the <code>axvpb.sync</code> word.</P> 84<P>To synchronize the entire structure, assert the <code>AX_SYNC_USER_LPF</code> bit.</P> 85<h2>See Also</h2> 86 87<p> 88<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> 89</p> 90 91<h2>Revision History</h2> 92<P>03/01/2006 Initial version.</P> 93 94</body> 95</html> 96 97