What is KVR Audio? | Submit News | Advertise | Developer Account

Options (Affects News & Product results only):

OS:
Format:
Include:
Quick Search KVR

"Quick Search" KVR Audio's Product Database, News Items, Developer Listings, Forum Topics and videos here. For advanced Product Database searching please use the full product search. For the forum you can use the phpBB forum search.

To utilize the power of Google you can use the integrated Google Site Search.

Products 0

Developers 0

News 0

Forum 0

Videos 0

Search  

How do you create an impulse response to create a brickwall FIR filter?

DSP, Plug-in and Host development discussion.

Moderator: Moderators (Main)

User avatar
Architeuthis
KVRAF
 
2341 posts since 27 Jan, 2006, from Mesa, AZ

Postby Architeuthis; Mon May 12, 2014 7:21 pm How do you create an impulse response to create a brickwall FIR filter?

How do you create an impulse to create a brickwall FIR filter?

I need to create a impulse to isolate a small band of frequencies. How do you go about creating that impulse for a convolution?
Soundemote Junebug Kit - a deeply sampled Snare, Kick, and Hat for breakbeat and drum'n'bass.
User avatar
FabienTDR
KVRian
 
603 posts since 23 Feb, 2012

Postby FabienTDR; Mon May 12, 2014 7:59 pm Re: How do you create an impulse response to create a brickwall FIR filter?

google "sinc function" and have a look at (impulse) windowing functions.
Fabien from Tokyo Dawn Records

Check out my audio processors over at the Tokyo Dawn Labs!
camsr
KVRAF
 
4640 posts since 16 Feb, 2005

Postby camsr; Tue May 13, 2014 8:47 am Re: How do you create an impulse response to create a brickwall FIR filter?

Yes, the Sinc Function and convolution. The length of the sinc impulse detemines the quality.
Image
User avatar
Architeuthis
KVRAF
 
2341 posts since 27 Jan, 2006, from Mesa, AZ

Postby Architeuthis; Tue May 13, 2014 10:06 am Re: How do you create an impulse response to create a brickwall FIR filter?

k thank you!
Soundemote Junebug Kit - a deeply sampled Snare, Kick, and Hat for breakbeat and drum'n'bass.
mystran
KVRAF
 
4188 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Wed May 14, 2014 7:30 am Re: How do you create an impulse response to create a brickwall FIR filter?

camsr wrote:Yes, the Sinc Function and convolution. The length of the sinc impulse detemines the quality.


Well it's not quite that simple.

Longer filter will get you a sharper transition, but it's mostly the window function used that sets the general shape (final attenuation and strength of the side-bands). Also windows that give you better attenuation also typically widen the transition, so what you probably want to do is first pick a window with a shape (in frequency domain) that works for your purposes, then adjust the length of the filter to control the transition width.

In other words, if the filter isn't sharp enough, then yeah, increasing the filter length will make it sharper. But if it's not filtering strongly enough (further away from the transition), then typically it's a better idea to choose a better window first. Similarly the other way, if you'd rather trade a bit worse stop-band performance for a sharper transition with a shorter filter, choosing another window is probably what you want.
Image <- plugins | forum
camsr
KVRAF
 
4640 posts since 16 Feb, 2005

Postby camsr; Wed May 14, 2014 8:32 am Re: How do you create an impulse response to create a brickwall FIR filter?

So how does a rectangular window outperform/underperform other types here?
Image
mystran
KVRAF
 
4188 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Wed May 14, 2014 12:48 pm Re: How do you create an impulse response to create a brickwall FIR filter?

camsr wrote:So how does a rectangular window outperform/underperform other types here?


See http://en.wikipedia.org/wiki/Window_function

If I'm not mistaken, essentially any other window will have a wider main lobe, so result in more "blurring" of the response, which makes rectangular ideal(?) in terms of frequency resolution. On the other hand, among the practical windows, rectangular has the highest "side-lobes" (with the first one down some -12dB or so) and they don't really decay that fast either, so it's very poor in terms of attenuation and there is a lot of "ripple" in the response.

In practice, for audio use pretty much anything is better than rectangular. Even the commonly suggested Hann and Hamming windows place too much emphasis on narrow transition though. This is obviously a bit of a matter of opinion, but as a rule of thumb, you'd probably want to start with side-lobes down by at least around 60dB and ideally about twice that (depends a bit on application though).

So for very short filters, I'd generally start by trying Blackman (simple 2 term cosine window, see the Wikipedia page). If you can spare a few extra taps (or accept some extra transition; I'd argue that most of the time this is the case), then try Nuttall instead (also simple, 3 term cosine), that's what I usually use as my default (slightly higher first lobes compared to Blackman-Nuttall, but has the advantage of faster decay further away from transition which is useful for some applications).

Nuttall (and similar) is audibly pretty transparent in most cases, but if you're aiming for truly transparent quality, then some people here have argued for windows with even more attenuation. IIRC r8brain at least had some custom design, but I can't remember the details so see the source if you're interested.

Beyond the simple cosine-windows, if you don't mind a slightly more complex formulas then the (fairly popular) Kaiser window (approximating DPSS, which maximizes energy in main-lobe, though I'm not quite sure why that would be useful for general audio) will let you set a custom trade-off between side-lobes and main-lobe width, while Dolph–Chebyshev can give you all the side-lobes at the same level (so you get a sort of "min-max" window, which unfortunately does not mean your final filter will be min-max optimal).

tl;dr?

Well, the short version: rectangular sucks for most purposes. I'd try Nuttall as default and if you're totally convinced that it loses too much transition width, then Blackman. If you're a control-freak, then Kaiser is the simple approach for having a directly adjustable tuning parameter.

PS. However.. it DOES depend a bit on application; the above covers most situations where I would personally use windowing (whether for filter synthesis or signal analysis), but it's entirely possible that there are situations where none of this advice is useful, you don't care about side-lobes strength, and the selectivity of the rectangular is exactly what you need.

The images of window spectra on Wikipedia page are very helpful and essentially show you the ripple in the final designs. When you add more taps, you mostly just scale the width of the x-axis so the features become more concentrated to certain frequencies, but you only get extra attenuation where there is decay in the window response and only as fast (move away from transition) as the window response decays.
Image <- plugins | forum
mystran
KVRAF
 
4188 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Wed May 14, 2014 1:07 pm Re: How do you create an impulse response to create a brickwall FIR filter?

Finally, I'd like to add that "Hann" window, while not terribly useful in practice, is indeed educationally useful and worth implementing as the first-step replacement for rectangle. Once you have that working (aligned correctly and such), it's very simple to add a few extra terms for higher order cosine-windows. :)
Image <- plugins | forum
camsr
KVRAF
 
4640 posts since 16 Feb, 2005

Postby camsr; Wed May 14, 2014 3:19 pm Re: How do you create an impulse response to create a brickwall FIR filter?

Wasn't too long at all, thanks. Your advice is always appreciated (because it's good) :)
Refresh my memory, what's this chart depicting?
Image
Image
User avatar
FabienTDR
KVRian
 
603 posts since 23 Feb, 2012

Postby FabienTDR; Wed May 14, 2014 6:52 pm Re: How do you create an impulse response to create a brickwall FIR filter?

camsr wrote:So how does a rectangular window outperform/underperform other types here?


It results in the steepest transition band. All other windows trade steepness with passband flatness and/or stopband flatness.

Better or worse fully depends on the application.

I found that parametric windows (Kayser-Bessel, Dolf-Chebychev) to replace all other window types in practice.

The Sinc is an optimal frequency domain filter (in the sense that it has excellent frequency splitting abilities).

It's not that great in the time-domain, since it comes with pretty heavy ripples in the step response (as long as it hasn't been windowed to "death", i.e. as long it doesn't look like a gaussian).
Fabien from Tokyo Dawn Records

Check out my audio processors over at the Tokyo Dawn Labs!
User avatar
Architeuthis
KVRAF
 
2341 posts since 27 Jan, 2006, from Mesa, AZ

Postby Architeuthis; Sun May 18, 2014 9:19 am Re: How do you create an impulse response to create a brickwall FIR filter?

this has been helpful, thank you!
Soundemote Junebug Kit - a deeply sampled Snare, Kick, and Hat for breakbeat and drum'n'bass.

Moderator: Moderators (Main)

Return to DSP and Plug-in Development