I want to make a FIR filter. I have an array of coefficients (buffer[size]) and an array of data (filter[size_filter]). I have to do a convolution between the two arrays:
for(j = 0;j < size+size_filter;j++)
{
output[j] = 0;
for(i = 0;i < size_filter;i++)
{
output[j] += buffer[i]*filter[j-i];
}
}
output[size+size_filter] is the result. Where I'm wrong?
and also make sure that j-i will not be negative
From what I can see, none of the answers given will work. I am copying this from a website, but the code below works great for processing samples from a file:
Taken from:
https://sestevenson.wordpress.com/implementation-of-fir-filtering-in-c-part-1/