S711 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S7 · Lesson 11 · Fractional delay and interpolation

Delaying by part of a sample with linear, Lagrange and all-pass interpolators, and the Farrow structure

Many systems need a signal's value between its samples: a modem's timing recovery tracks a symbol clock that never lines up with the sampler, an audio resampler converts between rates with no simple ratio, a digital beamformer delays each element by a fraction of a sample. The ideal answer, a shifted sinc, is infinitely long. Practical interpolators are short filters whose coefficients depend on the fraction d, from the two-tap linear interpolator to Lagrange polynomials and all-pass designs, and how flat and how well delayed their response stays decides how much oversampling a system needs.

  • The curves are the magnitude responses of a linear (2-tap) and a cubic Lagrange (4-tap) interpolator set to the hardest fractional delay, halfway between samples.
  • Linear interpolation's response is cos⁡(ω/2): 0.44 dB down at 0.2π and 3 dB down at π/2.
  • The cubic's response stays within 0.03 dB to 0.2π: two more taps buy more than a factor of ten in accuracy at low frequencies.

Predict

A tone at 0.2π is delayed by half a sample with linear interpolation. How much is it attenuated, and how much with a cubic Lagrange interpolator?

Name it

The ideal

A delay of D samples (D not an integer) has H(ejω)=e−jωD and impulse response h[n]=sinc(n−D)=sin⁡π(n−D)π(n−D): infinite and noncausal, so it is approximated.

Lagrange interpolators

Fitting a polynomial of order N through N + 1 samples and evaluating it at D gives the FIR coefficients

h[n]=∏k=0,k≠nND−kn−k,n=0,…,N

exact for polynomials up to order N and maximally flat at ω = 0. Accuracy is best with D near the middle, (N − 1)/2 < D < (N + 1)/2.

  • N = 1 (linear): h = [1 − d, d], with |H|2=(1−d)2+d2+2d(1−d)cos⁡ω; at d = ½, |H|=cos⁡(ω/2).
  • N = 3 (cubic), D = 1.5: h = [−116,916,916,−116].

The Farrow structure

Each Lagrange coefficient is a polynomial in d, so the output is y=∑m=0Ncmdm with each cm the output of a fixed FIR filter. The fraction d can change every sample at the cost of evaluating one polynomial by Horner's rule: ideal for arbitrary-ratio resampling and timing recovery.

All-pass (Thiran) delays

A first-order all-pass a+z−11+az−1 with a=1−D1+D has exactly unity magnitude and a group delay of D at DC. It suits feedback structures such as physical-modeling synthesis, where any magnitude error would accumulate, but it can't be changed abruptly without transients.

Worked example

A system uses linear interpolation and needs the amplitude error at d = ½ below 0.01 dB. Up to what frequency can its signals go?

Show the solution
  1. Amplitude limit. At d = ½ the amplitude is cos⁡(ω/2), which must stay above 0.01 dB of loss: cos⁡(ω/2)≥10−0.01/20=0.99885
  2. Solve for ω. ω/2≤0.0480ω≤0.096rad That's 1.5% of the sample rate.
  3. What it means. Linear interpolation is accurate only on heavily oversampled signals, which is why high-quality resamplers use long polyphase or high-order Lagrange filters instead.

Answer up to ω = 0.096 rad, 1.5% of the sample rate.

Worked example

Find the first-order Thiran all-pass for a 0.3-sample delay, and check its DC group delay.

Show the solution
  1. Coefficient. a=1−0.31+0.3=0.538
  2. Group delay. A first-order all-pass a+z−11+az−1 has group delay τ(ω)=1−a21+2acos⁡ω+a2
  3. At DC. τ(0)=1−a1+a=0.4621.538=0.300samples as designed.
  4. Magnitude. Its magnitude is exactly 1 at every frequency; only the delay varies with frequency.

Answer a = 0.538, and the DC group delay is 0.300 samples.

Worked example

Interpolate cos(0.5πn) at n = 1.5 from its samples at n = 0 to 3, linearly and with the cubic Lagrange filter. How large are the errors?

Show the solution
  1. True value. cos⁡(0.75π)=−0.707
  2. Linear. From n = 1 and 2: x[1.5]≈12(0−1)=−0.5 an error of 0.207.
  3. Cubic. x[1.5]≈−116(1)+916(0)+916(−1)−116(0)=−0.625 an error of 0.082.
  4. At a lower frequency. At a quarter of the sample rate, even the cubic is crude; at 0.05 cycles per sample the errors fall to 0.011 and 0.0002.

Answer against the true −0.707, linear interpolation gives −0.5 (an error of 0.207) and the cubic gives −0.625 (an error of 0.082).

Check

A linear interpolator delays by d = 0.25 sample; a tone sits at ω = 0.1π.

(a)

What is |H| there?

(b)

How much does it attenuate the tone?

Check

Linear interpolation at d = ½ must stay within 0.01 dB.

(a)

Up to what fraction of the sample rate may the signal go?

Check

A cubic Lagrange interpolator (taps at n = 0 to 3) delays by D = 1.4.

(a)

What is h[0]?

(b)

What is h[1]?

Check

A first-order Thiran all-pass must delay by 0.4 sample at DC.

(a)

What is its coefficient a?

(b)

What group delay does it have at ω = π?

Check

The cubic Lagrange interpolator at D = 1.5 passes a tone at ω = 0.2π.

(a)

What is its amplitude there?

Check

Why does a timing-recovery loop in a modem use a Farrow interpolator rather than a bank of precomputed fractional-delay filters?

Check

A linear interpolator delays by d; separately, a first-order Thiran all-pass is designed for a delay D.

Step 1

What is the linear interpolator's |H| at frequency w?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Check

Write lagrange(N, D): the N + 1 Lagrange coefficients for a delay of D samples, and interp(x, n0, D, N): the value at n0 + D from the samples x[n0], …, x[n0 + N].

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Why do fractional-delay interpolators work well only for signals well below the Nyquist frequency?

Practice

Keep practicing

8 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.