Hi there,
I am currently experimenting with the vDSP_biquadm functions and I am having a couple of questions/doubts.
I thoroughly studied the vDSP.h header file and the BiquadSample/main.c file.
However - being a new API - there is not much information available online, other than the aforementioned sources.
In my specific example I am using the vDSP_biquadm interface in a real-time audio application.
All the functions in the API work as expected and make sense to me. The speed gains are significant.
In my process method I provide standard arrays of input and output buffers.
Samples in each buffer are arranged in a deinterleaved fashion.
I am using vDSP_biquadm_SetCoefficientsDouble() to assign new coefficients to the biquadm object.
The code I use is something like:
{
if (mUpdateCoeffs) {
vDSP_biquadm_SetCoefficientsDouble(mSetup, mCoeffs, 0, 0, mMaxSections, mMaxChannels);
mUpdateCoeffs = false;
}
vDSP_biquadm(mSetup, (const float **)inputBuffers, 1, outputBuffers, 1, numFramesToProcess);
}
Note that in the above code all the coefficients get directly assigned to the biquadm object without any kind of interpolation.
Also note that I am dumping all the coefficients at once (all sections, all channels)
I am aware this is not the most efficient way, and I should only assign the coefficients corresponding to the section(s) and channel(s) that have changed. However this is just a quick solution to check that I am using the API correctly. The above code works and produces the expected output.
Now, I want to implement coefficient smoothing...
I am thinking all I need to do is to substitute the above with the following:
{
if (mUpdateCoeffs) {
vDSP_biquadm_SetTargetsDouble(mSetup, mCoeffs, mInterpRate, mInterpThreshold, 0, 0, mMaxSections, mMaxChannels);
mUpdateCoeffs = false;
}
vDSP_biquadm(mSetup, (const float **)inputBuffers, 1, outputBuffers, 1, numFramesToProcess);
}
However this does not work. Although the filter coefficients still get somehow updated I get horrible zipper noise all over the place.
I should add that sometimes the vDSP_biquadm_SetTargetsDouble() function gets called again with new targets when the old ones are still being interpolated. I am hoping that inside the API there are provisions to deal with this case.
The problem I am having is that I don’t really understand what the interpolation rate and threshold mean.
For instance, let’s say that I would like to specify the interpolation time in ms, so with a sample rate of 44100Hz, if I choose 100ms as my interpolation time I should be able to interpolate all the filter coefficients over 4410 samples. However I am not sure how the rate argument relates to time. Also as far as the interpolation threshold goes, I would like the coefficients to get interpolated until they exactly match the targets, so should I choose 0.0 as the value for the threshold argument? How does the rate argument relates to time in samples?
Can anybody point out what I am misunderstanding and explain how to use this API to accomplish real-time filter coefficients interpolation?
Thanks a lot for any help.
- Luigi Castelli