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 : 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?
Linear interpolation averages the two neighbors: , −0.44 dB. The cubic, , gives , −0.03 dB. Both are exact at DC; the higher order stays flat further.
Name it
The ideal
A delay of D samples (D not an integer) has and impulse response : 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
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 ; at d = ½, .
- N = 3 (cubic), D = 1.5: h = .
The Farrow structure
Each Lagrange coefficient is a polynomial in d, so the output is with each 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 with 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
- Amplitude limit. At d = ½ the amplitude is , which must stay above 0.01 dB of loss:
- Solve for ω. That's 1.5% of the sample rate.
- 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
- Coefficient.
- Group delay. A first-order all-pass has group delay
- At DC. as designed.
- 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
- True value.
- Linear. From n = 1 and 2: an error of 0.207.
- Cubic. an error of 0.082.
- 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°.
Step 2
What is the Thiran coefficient?
Step 3
What is its group delay at frequency w?
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?
An interpolator estimates values between samples by fitting a smooth curve, a low-order polynomial for Lagrange filters, through nearby samples. A signal far below the Nyquist frequency changes little between samples and looks locally like a polynomial, so the fit is accurate. As the frequency rises, the signal wiggles more between samples and a short polynomial can't follow it, so the interpolated values lose amplitude and pick up errors; at half the sampling rate a half-sample delay is impossible to get right with any short filter. Systems that need accurate fractional delays therefore oversample, or use long interpolation filters.
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.