3
$\begingroup$

Given a physical system (e.g., loudspeaker and microphone) with DA and AD converters. Playing a single pulse from the loudspeaker, I will most likely receive the pulse at the microphone with a fractional delay.

If the system and sound propagation were ideal, this fractional delay would extend infinitely to the past (see an example). Thus, I would receive some signal at the microphone before it was emitted in the loudspeaker.

As this is not possible, how can we harmonize the causality of the system with the non-causality of the fractional delay?

$\endgroup$
2
  • $\begingroup$ What the other guys are saying is true, but I think the emphasis is a teeny-bit misleading. While it is impossible to construct a perfect brick wall low-pass filter for reconstruction, you can get arbitrarily close as long as you're willing to put up with more delay. So, if you're willing to put up with a minimum of 31 samples of delay, you can use a 64-tap polyphase FIR filter that's pretty damn close to a brick wall and you can have whatever precision of fractional delay you want as long as it's at least 31 samples. $\endgroup$ Commented May 20, 2023 at 21:05
  • $\begingroup$ I spell this out explicitly how to do this in this answer to a different question about comb filters. Using MATLAB to design the virtual brick wall filter can be another question to discuss. $\endgroup$ Commented May 20, 2023 at 21:06

5 Answers 5

10
$\begingroup$

It's not the delay itself that causes the total discrete-time system to be non-causal. In continuous time we simply have an impulse response $\delta(t-t_0)$, which is clearly causal for $t_0>0$. The ideal transformation to a discrete-time system involves an ideal (non-causal) lowpass filter and (ideal) sampling. This results in the well-known sampled sinc function for a discrete-time fractional delay filter. If the delay happens to be an integer multiple of the sampling period, the sinc function is sampled at its zero crossings (apart from the one sample at the main lobe), and in this case the discrete-time filter is causal with impulse response $\delta(n-n_0)$, where $n_0$ is of course a positive integer. In all other cases, the resulting impulse response is non-causal due to the sampling of the non-causal impulse response of the ideal low pass filter.

In practice, the ideal low pass filter is of course replaced by some causal and stable system, and the corresponding discrete-time system approximating a fractional delay is causal.

$\endgroup$
5
$\begingroup$

Just an expansion on Matt's great answer: you have stumbled into the "dirty little secret of sampling" :-)

In order to sample without aliasing the signal has to be bandlimited. However, any signal that's limited in time cannot be bandlimited. Any real world signal is time bound (at least on one side): They all need to have a start and we cannot access future samples at time of sampling.

Hence: we cannot sample a real world signal without some amount of aliasing.

In practice that just means that you have to carefully control the sampling process to minimize the different error types based on the requirements of you application. typically you end up with a small amount of aliasing and some amount of pre-ringing, which is what you are referring to.

For example the feedback path in an active noise cancelling headset is very sensitive to latency and pre-ringing. The work around for this is to use a high sample rate and a minimum phase anti aliasing filter.

$\endgroup$
5
  • $\begingroup$ Nice addition ! $\endgroup$ Commented May 19, 2023 at 23:26
  • 1
    $\begingroup$ Why is the minimum phase filter helpful for that matter? Doesn’t the phase distortion introduced by the minimum phase filter affect the canceling of noise? I would assume that in this application, a linear phase would be quite important $\endgroup$
    – Yair M
    Commented May 20, 2023 at 6:14
  • 1
    $\begingroup$ @YairM. Linear phase creates a lot more phase distortion than minimum phase. In many applications that can be compensated by simply delaying any other signal by the bulk delay of the linear phase filter, but for an active feedback loop, that doesn't work. Latency is a HUGH problem for active feedback loops and any dedicated ANC chip is specifically designed around minimizing latency as much as possible. $\endgroup$
    – Hilmar
    Commented May 21, 2023 at 1:04
  • $\begingroup$ @Hilmar, I understand your statement regarding the delay and why it is unacceptable for active feedback, and I understand why the minimum phase will be better in terms of pre-ringing. However, the whole point of the linear phase is the constant group delay, i.e., no phase distortion. In what do linear phase filters introduce distortion? $\endgroup$
    – Yair M
    Commented May 23, 2023 at 19:09
  • $\begingroup$ That really depends on whether you care about absolute or relative phase distortion $\endgroup$
    – Hilmar
    Commented May 23, 2023 at 23:09
2
$\begingroup$

If the system and sound propagation were ideal, this fractional delay would extend infinitely to the past.

I believe this is where your problem lies.

You go from talking about a real system (D to A, speaker, microphone, A to D), and then you say that it can't be an ideal system.

This train of thought has three problems:

  1. Ideal systems are nice, but we only get to play with real ones.
  2. Whose ideal is it, anyway?
  3. Fractional delays -- who cares?

If you're talking about a typical audio system, then if you measured the time from the moment that a signal is applied to the D to A to the moment that you detect signal at the A to D output, you would find many many samples worth of delay. I would assume that you'd see hundreds of samples, if not thousands, in a typical pro or prosumer audio setup.

Even in control systems applications (where I cut my teeth on DSP), a normal system has a bandwidth that's 1/10th or less than the sampling rate, meaning that from the moment that you advance a command to the loop until the time that you can really see a result is several samples, and the motion isn't really done for tens or hundreds of samples.

$\endgroup$
1
$\begingroup$

Causality is harmonized because in the real world one can not sample after a mathematically perfect brick-wall linear-phase anti-aliasing filter, but a physically realizable anti-aliasing filter, which is neither brick wall in frequency response, nor linear phase. The sample of the transient will thus be (very slightly) distorted, and the phase of a matching reconstruction filter will be closer to a one-sided minimum phase IIR filter, with one long tail, not a linear phase FIR filter with two infinite tails.

$\endgroup$
2
  • 1
    $\begingroup$ I believe that audio ADC and DAC commonly have effective filtering (analog + digital) that resemble linear phase. $\endgroup$
    – Knut Inge
    Commented May 20, 2023 at 21:31
  • $\begingroup$ I know that sample-rate converters do. Analog Devices AD1890 and descendants have pretty bricky linear-phase filters. But, if I recall what Bob Adams said, they were 64 tap filters polyphase filters. I dunno how many phases he had, I might guess 256 or 512 different 64-tap FIRs and he linearly interpolated in between. $\endgroup$ Commented May 21, 2023 at 6:26
1
$\begingroup$

I wasn't originally gonna answer this.

So you can have fractional-delay filters in sorta an IIR way, using all-pass filters with a negative pole value. This approximates linear phase only for low frequencies. But you can get delays between 0 and 1 sample delay and nicely controllable for low frequencies.

$$ H(z) = \frac{-p + z^{-1}}{1 - p \, z^{-1}} $$

where $p = \frac{\tau - 1}{\tau + 1} $

and $0 \le \tau < 1$ is the fractional-sample delay at DC.

Or you can have really flat and linear-phase fractional-precision-delay filters using a polyphase FIR structure. But the delay has to be longer. Nonetheless you can get fractional-sample-precision delay that's real good, as long as you're willing to accept a minimum delay.

So make it causal, but compensate for some fixed, minimum delay you will need. That might put a small, integer-sample overall delay in the whole real-time system, which usually isn't a problem, is it?

$\endgroup$

Your Answer

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

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