From: Rune Allnor on 7 Dec 2006 18:47 Fred Marshall skrev: > On the other hand, a program much like P-M could be made available as a > function call that would take arbitrary shapes and weights. You may be right, from a purely technical point of view. However, a function like P-M has lots of control factors, desired responses, error weight factors etc, which makes it hard to use. It's been a few months since I read up on P-M now, so I don't remember the exact details. The reason why the Remez exchange can be used for optimization is that some cos(n*cos(x)) terms appear in the expressions to be optimized. If it turns out that one of those cosines are the basis finctions for the filters, optimizing the filters for other types of functions excludes the Remez algorithm. In that case, some other optimization method must be used, which may or may not be hard. > My question > was: is this to the point and useful? The notion wasn't that a beginner > should do the programming - just make the function calls. I don't think so. I think such a function would be very hard to learn wot to use and to control. I think it would require more time for preparations than most DIY'ers could reasonably be expected to spend. > Regarding length: I've never been too keen on length estimators because > iterating on length is so easy (and fast) to do under many circumstances. > That and the fact that length can be estimated in a gross way as the > reciprocal of the narrowest transition width. At least that estimate tells > you if you are in dreamland. The length estimators I have seen seem to be more or less intricate variations over the theme "transition bandwidth". Rune
From: Rune Allnor on 7 Dec 2006 18:54 Ron N. skrev: > Rune Allnor wrote: > > Ron N. skrev: > > > jeff227 wrote: > > > > Has anyone come up with a "cookbook" for simple FIR filters similar to > > > > RBJ's IIR cookbook? > > > > > > Here's a filter cookbook that uses a simple scaled windowed sinc > > > to create arbitrary single cutoff FIR filters: > > > > > > http://www.musicdsp.org/files/wsfir.h > > > > > > Basically, you get only three degrees of freedom: sample rate, > > > filter length, and (stop or) passband width. > > > > How can a FIR filter design newbie be expected to choose a > > good filter length? > > I suppose a nice addition to these cookbook filters would > be a function to return estimates of the transition band, > passband ripple, and peak stopband ripple for a given set > of the 3 filter parameters plus the word size. > > I note that this was not done for RBJ's IIR cookbook, where > the number of bits of precision can seriously affect the QOR > for certain combinations of sample rate and "turning" frequency. It's been a couple of years since I looked at RBJ's cookbook, so I won't criticize it too much. But once you start adding details like that, you pretty soon end up with a full-scale filter design paper. The "simple" Cheb 1 IIR HP filter: - Select a passband corner frequency - Select a stopband corner frequency - Select passband ripple - Select stopband attenuation - Convert to LP prototype - Pre-warp to analog domain - Compute filter order - Compute biquad parameters - BLT back to discrete-time domain - Apply a frequency transform to get the final parameters Even for an as "simple, standard" filter as the Cheb 1, this is alrady a step or two beyond what I would say is "cookbook level". Rune
From: Ron N. on 7 Dec 2006 21:16 Rune Allnor wrote: > Ron N. skrev: > > Rune Allnor wrote: > > > Ron N. skrev: > > > > jeff227 wrote: > > > > > Has anyone come up with a "cookbook" for simple FIR filters similar to > > > > > RBJ's IIR cookbook? > > > > > > > > Here's a filter cookbook that uses a simple scaled windowed sinc > > > > to create arbitrary single cutoff FIR filters: > > > > > > > > http://www.musicdsp.org/files/wsfir.h > > > > > > > > Basically, you get only three degrees of freedom: sample rate, > > > > filter length, and (stop or) passband width. > > > > > > How can a FIR filter design newbie be expected to choose a > > > good filter length? > > > > I suppose a nice addition to these cookbook filters would > > be a function to return estimates of the transition band, > > passband ripple, and peak stopband ripple for a given set > > of the 3 filter parameters plus the word size. > > > > I note that this was not done for RBJ's IIR cookbook, where > > the number of bits of precision can seriously affect the QOR > > for certain combinations of sample rate and "turning" frequency. > > It's been a couple of years since I looked at RBJ's cookbook, > so I won't criticize it too much. But once you start adding details > like that, you pretty soon end up with a full-scale filter design > paper. > > The "simple" Cheb 1 IIR HP filter: > > - Select a passband corner frequency > - Select a stopband corner frequency > - Select passband ripple > - Select stopband attenuation > - Convert to LP prototype > - Pre-warp to analog domain > - Compute filter order > - Compute biquad parameters > - BLT back to discrete-time domain > - Apply a frequency transform to get the final parameters > > Even for an as "simple, standard" filter as the Cheb 1, this > is alrady a step or two beyond what I would say is "cookbook > level". That's more knobs than someone using a simple cookbook recipe, as opposed to creating a new entree from scratch, might want or need to have available to turn.
From: Ron N. on 7 Dec 2006 21:36 robert bristow-johnson wrote: > Ron N. wrote: > > > > Can't one just precalculate one filter and shift it about? > > yeah, probably. i presume you mean "scale" instead of "shift". (or do > you mean "shift and overlap-add" for additional features?) > > > (similar to how your IIR cookbook picks one basic pole/zero > > geometry and just scales their locations for the filters few > > degrees of freedom...) > > > > I would start with a Hamming windowed (trig table lookup) > > sinc (pre-fft'd rectangle), and see it that fits his needs well > > enough (before getting out a pile driver when a boot heel > > would have sufficed). > > actually, the idea of a cookbook is a collection of optimized recipes > that make for a pretty good tasting souffle that would, for the > resources, be pretty hard to improve upon if you follow the directions > carefully. That's one class of cookbook. Hardbound. Fancy cover. Another class, likely in paperback, are affordable and quick recipes which require mostly ingredients usually already stocked in the pantry. Another one I recall was a college students survival cookbook: how to make those last few boxes of mac'n'cheese and ramen semi-edible when one became hungry enough... :) Probably sold better than many fancy cookbooks in the bookstores near campus.
From: Fred Marshall on 7 Dec 2006 21:37
"Rune Allnor" <allnor(a)tele.ntnu.no> wrote in message news:1165535244.696120.130260(a)79g2000cws.googlegroups.com... > > Fred Marshall skrev: > >> On the other hand, a program much like P-M could be made available as a >> function call that would take arbitrary shapes and weights. > > You may be right, from a purely technical point of view. However, a > function like P-M has lots of control factors, desired responses, error > > weight factors etc, which makes it hard to use. > > It's been a few months since I read up on P-M now, so I don't > remember the exact details. The reason why the Remez exchange > can be used for optimization is that some cos(n*cos(x)) terms > appear in the expressions to be optimized. If it turns out that one > of those cosines are the basis finctions for the filters, optimizing > the filters for other types of functions excludes the Remez algorithm. > In that case, some other optimization method must be used, > which may or may not be hard. > >> My question >> was: is this to the point and useful? The notion wasn't that a beginner >> should do the programming - just make the function calls. > > I don't think so. I think such a function would be very hard to learn > wot to use and to control. I think it would require more time for > preparations than most DIY'ers could reasonably be expected to > spend. .............................................> > Rune Well, I guess it depends on what you call "hard to learn". We're already talking in the context of a function call so that assumes some sort of programming. Or, it could be simpler than that if one would simply re-write the P-M style of interface (and the underlying program) to say: Give the length of filter desired. Give the number of points in the desired frequency response on a regular grid. Give the desired frequency response values on that grid. Give the weighting function on that grid. Results: The filter coefficients. The weight-normalized ripple. A filter response plot or listing perhaps etc. I don't think this would be hard to learn how to use effectively. I can imagine a graphical interface for the magnitude response and for the weight function (which can always be 1.0 everywhere). Some learning by trial would seem to make it pretty easy to do. For example, I've found that having low weights in the transition band usually puts all the ripples in the passband or stopband - just like a more typical P-M. And, there are reasons for that anyway - as P-M treats the transition bands as "don't care" regions really. All that said, I don't think one should use something like this as a "black box" in an automated system unless the requirements are constrained - because one *can* generate some weird filter responses. Fred |