Am Donnerstag, den 10.06.2010, 23:18 +1000 schrieb Damien Zammit:
Hi,
I have written a FFTW based block convolution jack client, but I am
having difficulty processing the last jackframes%L samples of the jack
buffer. I have read that it might be an idea to collect the samples
into a second buffer and process them independently of the jack
process callback, but I have no clue how to implement that. Any
suggestions would be appreciated.
I want to use the Parks-McClellin algorithm to generate some FIR
filter coefficents with some user configurable parameters and have it
process the filters using block convolution. Possibly as an addon for
calf?
So far my jack client works, and the block convolution overlap-add
algorithm works as per Oppenheim and Schafer, but the last few samples
of each jack buffer are zeroes.
It would be nice to be able to have FIR filters longer than the size
of the jack buffer too. Any ideas?
---
Damien Zammit
Hi
here is the implementation I used for a time domaine convolution with a
fixed filter kernel length
inline void convolver_filter(float* input, float* output, int sf,
unsigned int iconvolvefilter)
{
// select kernel filter
if (iconvolvefilter >= sizeof(filters) / sizeof(filters[0])) {
iconvolvefilter = 0;
}
// push last samples to the start
for (int i=0; i < 45; i++) {
result[i] = result[sf+i];
}
// set the rest to zero
for (int i=45; i < sf+46; i++) {
result[i] = 0;
}
// Do convolution:
for (int i = 0; i < sf; i++) {
for (int j = 0; j < 45; j++) {
result[i+j] += input[i] * filters[iconvolvefilter][j];
}
}
for (int i = 0; i < sf; i++) {
*output++ = result[i];
}
}
result[] is a internal buffer with length = jack_buffer_size + kernel
filter length.
sf is the jack_buffer_size.
greats hermann