0
$\begingroup$

Disclaimer: this feels like something that should be obvious from an intro class, but for some reason I can't find anything around this.

I'm working on an algorithm that takes a signal, let's call it S_in. I'm running both a high pass and low pass filter (identical parameters otherwise) on it so that I can work on different frequency bands of the signal with slightly different parameters in my algorithm. So, lpf(S_in) and hpf(S_in). When I mix them back together (which I'm doing in the time domain via just simple addition, S_out = lpf(S_in) + hpf(S_in)), I get significant "interference" in the transition band in the resulting signal, usually in the form of something that resembles a band stop/notch filter at my original cutoff frequency. This happens even if I don't run those signals through my algorithm (i.e., S_in != S_out; preferably they would be approximately equal to each other, instead of significantly different).

As a "workaround" I noticed if I offset the addition by as few as 8 or 16 samples on one of the signals (that is, a time delay on one of the streams; also 44100 samples/sec audio fwiw), then the frequency response of the mixed signal looks much more flat relative to my original signal (which is what I want -- the band stop is gone, though there's still clearly some interference pattern in the shared transition band).

What am I doing wrong here? Is this a simple signal processing thing I've forgotten about and can't figure out how to search for it? Is it an artifact of discretization/rounding errors of my implementation? (Though since I can reproduce that same behavior in common audio editing software, I don't think it's just my implementation). I'm using a low order biquad filter for the filters (is it that? obviously a higher order filter would shrink the transition band, but is that the "right" fix, or just a workaround?). Is there a "right" way to mix them back together, or a "right" way to do my overall algorithm where I need to process frequency bands separately and then mix them back together?

$\endgroup$

1 Answer 1

0
$\begingroup$

You are assuming that a parallel high pass and low pass add up to "flat". In most cases, they do not. You have to carefully design both the phase and the amplitude responses in the transition band to match each other.

There are a few classes of filters that are useful here

  1. 1st order lowpass/highpass to add up to unity
  2. Odd order butterworth filters add up to an allpass filter (flat frequency response, but some phase distortion). The two paths are either 90 or 270 degrees phase shifted (depending on order)
  3. Linkwitz Riley filter (two butterworth cascaded) also add up to an allpass (when choosing the appropriate sign for recombination). The two paths are in phase or out of phase (depending on order).
  4. linear phase FIR filters that are designed complementary.
  5. Specific types of filter banks (reconstructing)

All of this only helps if your processing doesn't induce significant differential phase shifts. Unless this phase shift is constant and can be compensated, you will always get some amount of interference.

$\endgroup$
2
  • $\begingroup$ Very enlightening. As my processing will actually cause phase shifts in some frequencies, I'll have to investigate on each point you listed here and see what works best for my use case (I'm assuming that "some amount" will be better or worse depending on the chosen filter/setup, so my preference would be to find something that reduces interference as much as possible). Is there some terminology around what I'm asking in my question and your explanation that I could read some more background on, and would better help to refer to this scenario in the future? $\endgroup$
    – vulture
    Jul 6, 2019 at 19:29
  • $\begingroup$ You could look up "perfectly reconstructing filter banks" but these are typically add down- and up-sampling to the mix which complicates things further.All of the approaches have different strengths and weaknesses and the best solution depends a lot on your specific requirements and constraints: latency, MIPS, memory, transient preservation, corner frequencies, etc. $\endgroup$
    – Hilmar
    Jul 7, 2019 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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