Log in
Register
Home
Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
News
Members
Current visitors
New profile posts
Search profile posts
Features
Log in
Register
Search
Search titles only
By:
Search titles only
By:
New posts
Search forums
Menu
Install the app
Install
Reply to thread
Home
Forums
Pro Audio
Varsity
FIR filters
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Michael John" data-source="post: 147690" data-attributes="member: 830"><p>Re: FIR filters</p><p></p><p>Whilst FIR filters are frequently referred to as having linear phase (or no phase variation), FIR filters can actually have almost any or arbitrary phase.</p><p></p><p>Here's a short primer which might be useful... (I hope)</p><p></p><p>A FIR filter is a filter where each output sample is just a weighted sum of a history of input samples. The filter has no feedback. For example:</p><p></p><p> s = in_sample</p><p> out_sample = 0.1 * s + 0.6 * previous_s + 0.3 * previous_previous_s</p><p></p><p>The impulse response length is just the length of the filter. Put in a 1 followed by lots of zeros and only 3 non-zero samples come output.</p><p> 0.1</p><p> 0.6</p><p> 0.3</p><p> 0</p><p> 0</p><p> ....</p><p></p><p>An IIR filter is similar to a FIR filter except that the sample history can feed back and sum with the input sample. For example:</p><p></p><p> s = in_sample + -0.3076 * previous_s + 0.1883 * previous_previous_s</p><p> out_sample = 0.2202 * s + 0.4404 * previous_s + 0.2202 * previous_previous_s</p><p></p><p>FWIW, this IIR is a 2nd order Butterworth at 10 kHz (at a sample rate of 48 kHz)</p><p></p><p>The impulse response length is essentially infinite, due to the feedback. Put in a 1 followed by lots of zeros, and what comes out is a series of numbers that decay toward zero and continue indefinitely:</p><p> 0.22019</p><p> 0.50811</p><p> 0.33500</p><p> 0.00733</p><p> -0.06084</p><p> -0.02009</p><p> 0.00528</p><p> 0.00541</p><p> 0.00067</p><p> -0.00081</p><p> -0.00037</p><p> 0.00004</p><p> 0.00008</p><p> ....</p><p></p><p>The feedback in an IIR makes for filters with steeper magnitude responses with less computation however the feedback results in some phase variation across frequency (which we're all familiar with).</p><p></p><p>For a FIR to have similar performance to an IIR, the FIR typically needs to have more coefficients and therefore requires more computation. For the IIR filter above, it takes an 11 coefficient FIR to have similar magnitude performance down to about -90 dB. It also has similar phase.</p><p> 0.22019</p><p> 0.50811</p><p> 0.33500</p><p> 0.00733</p><p> -0.06084</p><p> -0.02009</p><p> 0.00528</p><p> 0.00541</p><p> 0.00067</p><p> -0.00081</p><p> -0.00037</p><p></p><p>So if an FIR filter is more computationally expense, why is it useful?</p><p></p><p>With enough taps (i.e. with the right length) a FIR filter can have an almost arbitrary magnitude and phase. With this flexibility, we can do things like alter the phase of a cabinet, correct for some horn internal reflection effects, and separately alter the mag/phase characteristic of each driver to improve crossover matching. This flexibility does come at the cost of delay.</p><p></p><p>Here's the same 10 kHz LPF filter (from above) but implemented as an FIR with linear phase - i.e. just bulk delay.</p><p> -0.000085851300000</p><p> -0.000259195300000</p><p> 0.000070486200000</p><p> 0.001712739900000</p><p> 0.002552043300000</p><p> -0.006652936700000</p><p> -0.029519627600000</p><p> -0.003574233400000</p><p> 0.276965408500000</p><p> 0.517506320200000</p><p> 0.276965408500000</p><p> -0.003574233400000</p><p> -0.029519627600000</p><p> -0.006652936700000</p><p> 0.002552043300000</p><p> 0.001712739900000</p><p> 0.000070486200000</p><p> -0.000259195300000</p><p> -0.000085851300000</p><p></p><p>Notice the symmetry in the filter. A linear phase FIR filter has a bulk delay of half the filter length. In this case 10 samples (0.208ms). At lower frequencies, this can be 10's of milliseconds.</p><p></p><p>It's also worth noting that reversing the order of the 11 FIR taps above creates a filter with the same magnitude response, but the opposite phase or "maximum phase." In this filter, the effective delay is the full length of the filter, or 11 samples.</p><p> -0.00037</p><p> -0.00081</p><p> 0.00067</p><p> 0.00541</p><p> 0.00528</p><p> -0.02009</p><p> -0.06084</p><p> 0.00733</p><p> 0.33500</p><p> 0.50811</p><p> 0.22019</p></blockquote><p></p>
[QUOTE="Michael John, post: 147690, member: 830"] Re: FIR filters Whilst FIR filters are frequently referred to as having linear phase (or no phase variation), FIR filters can actually have almost any or arbitrary phase. Here's a short primer which might be useful... (I hope) A FIR filter is a filter where each output sample is just a weighted sum of a history of input samples. The filter has no feedback. For example: s = in_sample out_sample = 0.1 * s + 0.6 * previous_s + 0.3 * previous_previous_s The impulse response length is just the length of the filter. Put in a 1 followed by lots of zeros and only 3 non-zero samples come output. 0.1 0.6 0.3 0 0 .... An IIR filter is similar to a FIR filter except that the sample history can feed back and sum with the input sample. For example: s = in_sample + -0.3076 * previous_s + 0.1883 * previous_previous_s out_sample = 0.2202 * s + 0.4404 * previous_s + 0.2202 * previous_previous_s FWIW, this IIR is a 2nd order Butterworth at 10 kHz (at a sample rate of 48 kHz) The impulse response length is essentially infinite, due to the feedback. Put in a 1 followed by lots of zeros, and what comes out is a series of numbers that decay toward zero and continue indefinitely: 0.22019 0.50811 0.33500 0.00733 -0.06084 -0.02009 0.00528 0.00541 0.00067 -0.00081 -0.00037 0.00004 0.00008 .... The feedback in an IIR makes for filters with steeper magnitude responses with less computation however the feedback results in some phase variation across frequency (which we're all familiar with). For a FIR to have similar performance to an IIR, the FIR typically needs to have more coefficients and therefore requires more computation. For the IIR filter above, it takes an 11 coefficient FIR to have similar magnitude performance down to about -90 dB. It also has similar phase. 0.22019 0.50811 0.33500 0.00733 -0.06084 -0.02009 0.00528 0.00541 0.00067 -0.00081 -0.00037 So if an FIR filter is more computationally expense, why is it useful? With enough taps (i.e. with the right length) a FIR filter can have an almost arbitrary magnitude and phase. With this flexibility, we can do things like alter the phase of a cabinet, correct for some horn internal reflection effects, and separately alter the mag/phase characteristic of each driver to improve crossover matching. This flexibility does come at the cost of delay. Here's the same 10 kHz LPF filter (from above) but implemented as an FIR with linear phase - i.e. just bulk delay. -0.000085851300000 -0.000259195300000 0.000070486200000 0.001712739900000 0.002552043300000 -0.006652936700000 -0.029519627600000 -0.003574233400000 0.276965408500000 0.517506320200000 0.276965408500000 -0.003574233400000 -0.029519627600000 -0.006652936700000 0.002552043300000 0.001712739900000 0.000070486200000 -0.000259195300000 -0.000085851300000 Notice the symmetry in the filter. A linear phase FIR filter has a bulk delay of half the filter length. In this case 10 samples (0.208ms). At lower frequencies, this can be 10's of milliseconds. It's also worth noting that reversing the order of the 11 FIR taps above creates a filter with the same magnitude response, but the opposite phase or "maximum phase." In this filter, the effective delay is the full length of the filter, or 11 samples. -0.00037 -0.00081 0.00067 0.00541 0.00528 -0.02009 -0.06084 0.00733 0.33500 0.50811 0.22019 [/QUOTE]
Insert quotes…
Verification
Post reply
Home
Forums
Pro Audio
Varsity
FIR filters
Top
Bottom
Sign-up
or
log in
to join the discussion today!