Rather than reinvent the wheel, I wonder if anyone could refer me to a 1D linear convolution code snippet in ANSI C? I did a search on google and in stack overflow, but couldn\'
Since, we are taking convolution of 2 finite length sequences, hence the desired frequency response is achieved if circular convolution is performed rather than linear convolution. A very simple implementation of circular convolution will achieve the same result as the algorithm given by Alex.
#define MOD(n, N) ((n<0)? N+n : n)
......
......
for(n=0; n < signal_Length + Kernel_Length - 1; n++)
{
out[n] = 0;
for(m=0; m < Kernel_Length; m++)
{
out[n] = h[m] * x[MOD(n-m, N)];
}
}