OK, so I am designing a 2 kHz bandpass FIR filter using the following parameters:
Fa = 1900 Hz Fb = 2100 Hz Fs = 50 kHz M = 33 pts Att = 40 dB
I calculated the coefficients using this online tool (https://www.arc.id.au/FilterDesign.html)
The code is written in C and consists of a circular buffer where the latest analog value from the ADC is stored, and for each new sample, the buffer is multiplied with the coefficients (the latest sample with coefficient 0, sample n-1 with coefficient 1 etc).
The filtering is working fine (2 kHz passes and frequencies above 3 kHz and below 1 kHz quickly drops), but what bothers me is that the output from the filter in the passband is attenuated rather heavily.
The input to the filter is in the range -2048 to +2047. I have to multiply the output with approx 15 to make the maximum output reach the same level, which also increases the noise level.
This is the first time I design this kind of filter, and I was under the impression that the attenuation in the passband would be close to zero. What am I missing out?