# How to derive filter design (with parameters) from existing FIR weights

I made a thing which involves a FIR filter, and in that process I cobbled together some random numbers for the convolution which I figured would work the way I wanted.

Now I want to be able to take what I "designed", and fiddle with it in a domain which gives me more control. Like in a filter design tool, or as the combination of trig functions with parameters I can twiddle with more coordination.

One candidate is a windowed sum of sinc() functions -- DSP Lego bricks that those are -- but maybe I can do better given the specifics.

Here are the specifics:

I have a buffer (real numbers), and I repeatedly convolve that buffer with a kernel handed down from the gods (meaning: I typed random numbers until something cool happened). The kernel is asymmetric, so some frequencies are pushed along the while others are more stationary, and some frequencies have a small amount of gain, so they grow exponentially until they fall of the end.

So what I'd like is a design technique where I can apply small gain in some frequency bands, attenuation in others, and varying degrees of phase shift as well. And the ability to fiddle with that until I have what I like the look of.

No hard engineering constraints, but being able to reproduce what I already have ({0.3, 0.2, 0.75, -0.14, -0.11} but upscaled to 28 taps) is a good starting point.

This is just about poking things and watching the ripples propagate and distort.

## 1 Answer

Sounds exactly like a description of the Matlab filter design tool, or the Python pyfdax tool.

You place zeros close to the unity circle for attenuation; the placement of the zeros is all the mathematical freedom you get in an FIR filter (all the poles are necessarily at z=0+0j).

Putting the poles closer or multiple distributed poles further away from the unit circle allows you to control phase evolution while maintaining a fixed attenuation.

• It took me a while to find a reference, but yeah, I can see how to read phase response (and, I guess, infer group delay) from a list of zeroes that way. I'll try hacking that up as an interface and see if I feel like I'm in control of anything.
– sh1
Jan 18, 2023 at 19:45