DSPRelated.com
Forums

Why not just make FIRs by hand?

Started by mavavilj August 17, 2016
On 8/19/16 2:28 AM, mavaviljggroup@gmail.com wrote:
> On Thursday, August 18, 2016 at 10:20:50 PM UTC+3, Tim Wescott wrote: >> On Thu, 18 Aug 2016 04:10:58 -0700, mavaviljggroup wrote: >> >>> On Wednesday, August 17, 2016 at 8:41:08 PM UTC+3, robert >>> bristow-johnson wrote: >>>> what you *can* do is draw any old arbitrary frequency response, iFFT >>>> it, window that impulse response to the length L and take your lumps as >>>> to how the frequency response gets changed. good windows (like Kaiser) >>>> might do better than bad windows and your resulting frequency response >>>> might look a lot like what you originally drew in. >>>> >>> >>> What's this FIR design method called? >>> >>> Are there some other "arbitrary response" FIR filter design methods >>> suited to be applied using the overlap-add method? >> >> I think it's called the "Bristow-Johnson". At least it is now, here. >> > > I think the method is also described here: > > http://www.dspguide.com/ch17/1.htm
i've always called it the "windowing method" of FIR design. use an FFT much larger than your expected FIR length. "draw" in your complex values of the frequency response which might be just the magnitude in the real part and zero in the imaginary part. inverse FFT. now you have an impulse response that is much longer than you want, shorten that with a Kaiser window, then FFT back and see what hit you got on shortening it. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On Sat, 20 Aug 2016 23:01:12 -0400, robert bristow-johnson
<rbj@audioimagination.com> wrote:

>use an FFT much larger than your expected FIR length. "draw" in your >complex values of the frequency response which might be just the >magnitude in the real part and zero in the imaginary part. inverse FFT. > now you have an impulse response that is much longer than you want, >shorten that with a Kaiser window, then FFT back and see what hit you >got on shortening it.
Make the FFT much larger than your expected FIR length, "draw" in your frequency response, then IFFT and observe where the magnitude of the impulse response becomes so small that it is significant. (You will have to define what "significant" means for yourself, but it is often closely related to the word sizes of your data, your coefficients, and your processor.) Truncate there. No window needed other than the implied rectangle. If you have several frequency responses that all must be accommodated by the same FFT/IFFT filter, then choose the FFT size for the filter with the longest impulse response. Again, Robert, we're on opposite sides of the "modify the data to fit the filter" vs "design the filter to fit the data" issue. Two equally viable approaches. Greg
On 8/21/2016 9:10 AM, Greg Berchin wrote:
> On Sat, 20 Aug 2016 23:01:12 -0400, robert bristow-johnson > <rbj@audioimagination.com> wrote: > >> use an FFT much larger than your expected FIR length. "draw" in your >> complex values of the frequency response which might be just the >> magnitude in the real part and zero in the imaginary part. inverse FFT. >> now you have an impulse response that is much longer than you want, >> shorten that with a Kaiser window, then FFT back and see what hit you >> got on shortening it. > > Make the FFT much larger than your expected FIR length, "draw" in your > frequency response, then IFFT and observe where the magnitude of the > impulse response becomes so small that it is significant. (You will have > to define what "significant" means for yourself, but it is often closely > related to the word sizes of your data, your coefficients, and your > processor.) Truncate there. No window needed other than the implied > rectangle.
That works great if you can implement that many coefficients. If you can't and the number of coefficients are less than optimal, then I believe RBJ's method is appropriate.
> If you have several frequency responses that all must be accommodated by > the same FFT/IFFT filter, then choose the FFT size for the filter with > the longest impulse response. > > Again, Robert, we're on opposite sides of the "modify the data to fit > the filter" vs "design the filter to fit the data" issue. Two equally > viable approaches. > > Greg >
-- Rick C
On Sunday, August 21, 2016 at 1:56:59 PM UTC-4, rickman wrote:
> On 8/21/2016 9:10 AM, Greg Berchin wrote: > > On Sat, 20 Aug 2016 23:01:12 -0400, robert bristow-johnson > > <rbj@audioimagination.com> wrote: > > > >> use an FFT much larger than your expected FIR length. "draw" in your > >> complex values of the frequency response which might be just the > >> magnitude in the real part and zero in the imaginary part. inverse FFT. > >> now you have an impulse response that is much longer than you want, > >> shorten that with a Kaiser window, then FFT back and see what hit you > >> got on shortening it. > > > > Make the FFT much larger than your expected FIR length, "draw" in your > > frequency response, then IFFT and observe where the magnitude of the > > impulse response becomes so small that it is significant. (You will have > > to define what "significant" means for yourself, but it is often closely > > related to the word sizes of your data, your coefficients, and your > > processor.) Truncate there. No window needed other than the implied > > rectangle.
which *is* a window with "scalloping effects" on the frequency response. i just think that for a given maximum FIR length, L, that a Kaiser (or even a Hamming or Hann) will do better. i have to confess that i have never used a Bartlett (or triangular) window. if i wanted a quick-and-dirty window (that would be easy to compute without a math library), i would grab a Hann or Hamming. never used a Blackman either, but i **have** proposed something similar but with the 3rd harmonic, not the 2nd.
> That works great if you can implement that many coefficients. If you > can't and the number of coefficients are less than optimal, then I > believe RBJ's method is appropriate.
It's the "Windowing Method of FIR design". as opposed to Parks-McClellan or Least Squares. it's *not* *my* method. it is in O&S in section 7.4 (p. 444 in my 1989 edition). it is, if i remember right (and this is going back to 1977, like 4 decades ago for me) where i **first** learned about windowing. if i were to teach someone, from DSP scratch, what windows are and what windows are used for, this would be my first practical application to show them what windowing is all about. just wanna make that clear. didn't invent the DFT or the Z transform either. r b-j
On Sunday, August 21, 2016 at 2:36:38 PM UTC-5, robert bristow-johnson wrote:
> > > No window needed other than the implied > > > rectangle. > > which *is* a window with "scalloping effects" on the frequency response.
Of course. But that same scalloping effect will occur whether you truncate the response arbitrarily or your arithmetic precision truncates it for you. Of course, one could dither the coefficients, but that is perhaps fodder for a different discussion.
> i just think that for a given maximum FIR length, L, that a Kaiser (or even a > Hamming or Hann) will do better.
I agree. I have even used that special window that you proposed a while back (I think that it was continuous through the 3rd derivative) in exactly this situation, to good effect. Greg
I'm moving to Vermont and starting an audio company that uses "hand-made FIR filters" with each tap individually crafted by RBJ

Bob
On Thursday, August 18, 2016 at 4:11:20 AM UTC-7, mavavil...@gmail.com wrote:
.> On Wednesday, August 17, 2016 at 8:41:08 PM UTC+3, robert bristow-johnson wrote:
.> > what you *can* do is draw any old arbitrary frequency response, iFFT it, window that impulse response to the length L and take your lumps as to how the frequency response gets changed.  good windows (like Kaiser) might do better than bad windows and your resulting frequency response might look a lot like what you originally drew in.
.> > r b-j
.> What's this FIR design method called?
.> Are there some other "arbitrary response" FIR filter design methods suited to be applied using the overlap-add method?

For those patient enough to perform more than one FFT there has been an algorithm available since the 1980s to calculate an equiripple approximation to an arbitrary response by an iterative procedure involving repeated FFT and IFFT. See:
Equiripple FIR Filter Design By The FFT Algorithm
A. Enis Cetin, Bilkent Univercity
Omer N. Gerek
Yasemin Yardimci

at:
http://kilyos.ee.bilkent.edu.tr/~cetin/fftfirk.pdf

"FIR filter design problem is formulated here to satisfy the frequency domain constraints on the magnitude response bounds and time domain constraints on the impulse response support. The design scheme is iterative in which each iteration requires two FFT computations. The resultant filter is an equiripple approximation to the desired frequency response."

Dale B. Dalrymple
On Monday, August 22, 2016 at 12:51:56 PM UTC-5, radam...@gmail.com wrote:

> I'm moving to Vermont and starting an audio company that uses "hand-made FIR filters" with each tap individually crafted by RBJ
I tried that ... well, 2/3 of that - moving to Vermont and starting an audio company that uses hand-made FIR filters. Didn't make any money but did spend a fair amount of time hiking mountain trails with RB-J.
On 8/22/2016 2:40 PM, Greg Berchin wrote:
> On Monday, August 22, 2016 at 12:51:56 PM UTC-5, radam...@gmail.com wrote: > >> I'm moving to Vermont and starting an audio company that uses "hand-made FIR filters" with each tap individually crafted by RBJ > > I tried that ... well, 2/3 of that - moving to Vermont and starting an audio company that uses hand-made FIR filters. Didn't make any money but did spend a fair amount of time hiking mountain trails with RB-J.
Do hand made FIR filters make a difference in the sound of audio gear? Do you have to implement the filters with vacuum tubes to get just the right tonal "feel"? -- Rick C
On Monday, August 22, 2016 at 6:58:47 PM UTC-4, rickman wrote:
> On 8/22/2016 2:40 PM, Greg Berchin wrote: > > On Monday, August 22, 2016 at 12:51:56 PM UTC-5, radam...@gmail.com wro=
te:
> > > >> I'm moving to Vermont and starting an audio company that uses "hand-ma=
de FIR filters" with each tap individually crafted by RBJ
> > > > I tried that ... well, 2/3 of that - moving to Vermont and starting an =
audio company that uses hand-made FIR filters. Didn't make any money but di= d spend a fair amount of time hiking mountain trails with RB-J.
>=20 > Do hand made FIR filters make a difference in the sound of audio gear? > Do you have to implement the filters with vacuum tubes to get just the=20 > right tonal "feel"? >=20
ones that use vacuum tubes as the tap elements (and making a CCD delay line= outa tubes) have a nice warm sound that is particularly well suited for au= dio. you might be able to do a nice convolutional reverb with, maybe, 100,= 000 vacuum tube triodes (12AX7 has two triodes per tube). i am waiting for someone like Bob to design a DSP targeted for audio outa t= ubes. every gate, every flip-flop made outa 1940's technology. that shoul= d have a wonderful warm analog sound. why shouldn't a company named Analog Devices do such? r b-j