I'm doing something like spatial audio algorithm using IIR modelled HRTFs. At each frame I get a direction information with azimuth and elevation, and then I have to find or interpolate the corresponding HRTF filter coefficients.

The problem is that time-varying filters will result in audible artifacts. My current solution is to apply a cross fade between each frame, which increases the total computational complexity. The artifacts are removed perfectly but I'm wondering if there is a better solution.

I've tried another method which updates the filter coefficient sample(s) by sample(s). The filter coefficients in the form of numerator and denominator polynomial are converted to $K$ parallel sections as $$ H(z) = \frac{b_0+b_1z^{-1}+\ldots + b_Nz^{-N}}{1+a_1z^{-1}+\ldots + a_Nz^{-N}} = \sum_{k=1}^{K} \frac{B_{0k}+B_{1k}z^{-1}}{1+A_{1k}z^{-1} + A_{2k}z^{-2}} + C_0 $$

For the beginning $20K$ samples, I update one parallel section every 20 samples. The updated section uses the previous section's filter state. But this only works when the direction (and the filter coefficient) varies slowly, e.g., 0.1 degrees per 20 ms. Although the output doesn't have audible discontinuities, but we can see some high-frequency noises from the spectrum. From this perspective I also tried a low-pass filter, but the artifacts are still very annoying when the filter changes not slowly enough.

To summary, my question is if there is a more computational efficient way, than cross fade, to reduce or remove the artifacts caused by time-varying IIR filters. Thank you in advance.

  • $\begingroup$ you might want to consider Lattice filter topology instead of biquads in parallel. And here is how to convert from Direct form biquads to Lattice biquads $\endgroup$ Jul 29 at 5:52
  • $\begingroup$ @robertbristow-johnson Hi robert and thank you. I'm not familiar with lattice structure but it has more multiplications than the other structures. I don't want a cross fade is just because its computational efficiency. Sorry for the confusion, I'll edit my question. $\endgroup$
    – ZR Han
    Jul 29 at 6:32
  • $\begingroup$ yes, Lattice is not as computationally efficient as are the Direct 1 or Direct 2 forms. but it's better for modulating coefficients. $\endgroup$ Jul 29 at 6:36
  • $\begingroup$ @ZRHan: what topology do use for your sections? Direct Form I ? $\endgroup$
    – Hilmar
    Jul 29 at 11:53
  • $\begingroup$ @Hilmar yes, it’s direct form I. $\endgroup$
    – ZR Han
    Jul 29 at 11:54

Here are a couple of ideas.

  1. Try it in the frequency domain. For typical HRTFs overlap-add and direct FIR implementation are typically a wash in terms efficiency. The overlap from the overlap-add may be enough to smear out the transition enough.
  2. If that's not working, you can try partially overlapping perfectly reconstructing windows, but that increases CPU again.
  3. Alternatively you an interpolate in the frequency or spatial domain. If you update every 1024 samples and your HRTFs are 128 samples long, you can do 8 intermediate updates. linear interpolation in the frequency domain is very cheap since you do it only once per FFT.
  4. Make sure that your poles have a smooth trajectory with HRTF location. That's typically the case if your HRTFs are done with a physical model that designs in IIR space, but NOT if the IIR coefficients come from fitting a measured or modeled FIR response. If the poles jump between neighboring location, you have a tough problem to solve.
  5. If your pole trajectories are smooth, put a 1rst order lowpass on the pole location and update every N samples or so. N=10 or N = 20 should be fine. Consider also putting the same lowpass on the residue locations (which are the zeros of the parallel section).
  6. Put a first order lowpass on the spatial location itself. Objects can only move and accelerate at a limited rate.
  7. Make sure you understand the requirements and the rationale behind the maximum speed required. Once objects are moving fast, spatial acuity goes way down and Doppler shifts become prominent. How much HRTF detail do you really need in these cases?
  • $\begingroup$ Thank you. 1. FFT vs low-order IIR I think the latter one saves CPU. 2. That’s what I’ve done for now, a cross fade when update. 3. Sorry I don’t understand it but I think it’s similar to partial update. 4&5. My modeling method guarantees all IIR filters share common poles so it’s not a problem for interpolation. 6. A low pass for the spatial location is a good idea and is actually what I’m going to do in the next step. 7. My requirements are simulating the head rotation surrounded by a 5.1 system, not for the object-based binaural sound. So Doppler effect seems not dominant. Appreciate again! $\endgroup$
    – ZR Han
    Jul 29 at 14:23
  • $\begingroup$ Now I get what you meant in the third point. I calculate several intermediate updates with the filter coefficients and it works well! Thank you Hilmar! $\endgroup$
    – ZR Han
    Jul 30 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.