I have a couple use cases in a plug-in I’m writing where having a FIR lowpass filter would either be handy or is necessary.
I’ve found a couple examples of FIR implementations in C, but they’re all relying on coefficients that are pre-calculated. This won’t work for me, as I need a filter that can perform on bufferSize # of samples, with a particular cutoffFrequency that’s in relation to a sampleRate.
How can I go about calculating FIR coefficients with those three parameters in mind? I’ve been stumped by this, so your help is much appreciated!
One tentative solution I’ve come up with is to populate a buffer with a rectangle signal, then to perform an FFT on it to get a Sinc, and then to convolve that Sinc with my signal-to-be-filtered. The thing is, I’m uncertain how to create a rectangle that will communicate to the proper bandwidth for my filter given the above three parameter specifications. I’m also uncertain of if this is the most efficient method of calculating the coefficients or not.
Thanks for any help!