The following examples were generated using
Faust code similar to that
in Fig.
4.12 and the
faust2octave command
distributed with Faust.
Figure
shows the
amplitude responses of
Lagrange interpolation, orders 1 through 5, for
the case of implementing an
interpolated delay line of length
samples. In all cases the interpolator follows a
delay line of
appropriate length so that the interpolator coefficients operate over
their central onesample interval.
Figure
shows the
corresponding
phase delays. As discussed in §
4.2.10, the
amplitude response of every oddorder case is constrained to be zero at
half the
sampling rate when the delay is halfway between integers,
which this example is near. As a result, the curves for the two
evenorder interpolators lie above the three oddorder interpolators at
high frequencies in
Fig.
. It is
also interesting to note that the 4thorder interpolator, while showing
a wider ``pass band,'' exhibits more attenuation near half the
sampling
rate than the 2ndorder interpolator.
Figure 4.13:
Amplitude
responses, Lagrange interpolation, orders 1 to 5, for an
interpolated delay of samples. From the bottomright corner
along the right edge, the curves represent orders 1,3,5,4,2.

Figure 4.14:
Phase
delays, Lagrange interpolation, orders 1 to 5, for an interpolated
delay of samples. From bottom to top, the curves represent
orders 2,4,1,3,5.

In the phasedelay plots of
Fig.
, all cases
are exact at frequency zero. At half the sampling rate
they all give 5 samples of delay.
Note that all three oddorder phase delay curves look generally better
in Fig.
than
both of the evenorder phase delays. Recall from
Fig.
that the
two evenorder amplitude responses outperformed all three oddorder
cases. This illustrates a basic tradeoff between gain accuracy and
delay accuracy. The evenorder interpolators show generally less
attenuation at high frequencies (because they are not constrained to
approach a gain of zero at half the sampling rate for a halfsample
delay), but they pay for that with a relatively inferior phasedelay
performance at high frequencies.
Figures
4.15 and
4.16 show
amplitude response and
phase delay, respectively, for 4thorder
Lagrange interpolation
evaluated over a range of requested delays from
to
samples
in increments of
samples. The amplitude response is ideal (flat
at 0
dB for all frequencies) when the requested delay is
samples
(as it is for any integer delay), while there is maximum
highfrequency attenuation when the
fractional delay is half a sample.
In general, the closer the requested delay is to an integer, the
flatter the amplitude response of the Lagrange interpolator.
Figure 4.15:
Amplitude responses,
Lagrange interpolation, order 4, for the range of requested delays
, with thrown in as well (see next plot
for why). From bottom to top, ignoring the almost invisible split
in the bottom curve, the curves represent requested delays
, and . Then, because the curve for
requested delay is the same as the curve for delay
, for
, the same curves, from top to bottom,
represent requested delays
and
(which is nearly indistinguishable from ).

Figure 4.16:
Phase delays, Lagrange
interpolation, order 4, for the range of requested delays
, and additionally .

Note in Fig.
4.16 how the phasedelay jumps
discontinuously, as a function of delay, when approaching the desired
delay of
samples from below: The top curve in
Fig.
4.16 corresponds to a requested delay of 2.5
samples, while the next curve below corresponds to 2.499 samples. The
two curves roughly coincide at low frequencies (being exact at
dc),
but diverge to separate integer limits at half the
sampling
rate. Thus, the ``capture range'' of the integer 2 at half the
sampling rate is numerically suggested to be the halfopen interval
.
Figures
4.17 and
4.18 show
amplitude response and
phase delay, respectively, for 5thorder
Lagrange interpolation,
evaluated over a range of requested delays between
and
samples
in steps of
samples. Note that the vertical scale in
Fig.
4.17 spans
dB while that in
Fig.
4.15 needed less than
dB, again due to the
constrained zero at half the
sampling rate for oddorder interpolators
at the halfsample point.
Figure 4.17:
Amplitude responses,
Lagrange interpolation, order 5, for the range of requested delays
, with and included as well (see
next plot for why).

Figure 4.18:
Phase delays, Lagrange
interpolation, order 5, for the range of requested delays
, with and included as well.

Notice in Fig.
4.18 how suddenly the phasedelay curves
near 2.5 samples delay jump to an integer number of samples as a
function of frequency near half the
sample rate. The curve for
samples swings down to 2 samples delay, while the curve for
samples goes up to 3 samples delay at half the sample rate.
Since the gain is zero at half the sample rate when the requested
delay is
samples, the phase delay may be considered to be
exactly
samples at all frequencies in that special case.
Next Section: Avoiding Discontinuities When Changing DelayPrevious Section: Faust Code for Lagrange Interpolation