Next  |  Prev  |  Up  |  Top  |  REALSIMPLE Top


Tuning by Linear Interpolation

An overview of linear interpolation, among others, is given in [14]. The transfer function of first-order linear-interpolation can be written as

\begin{displaymath}
H_\eta(z) = (1-\eta) + \eta z^{-1},
\end{displaymath}

where $\eta\in[0,1]$ denotes the desired delay in samples at low frequencies compared with the sampling rate.


Faust Implementation.

Faust includes a function fdelay(n,d,x) defined in music.lib which provides fractional (non-integer) delay by means of linear interpolation:

  fdelay(n,d,x) = delay(n,int(d),x)*(1 - frac(d)) 
                + delay(n,int(d)+1,x)*frac(d);
Note that it also specifies a second delay line. However, a second delay-line is not implemented in the generated C++ code because Faust has an optimization rule that consolidates all delay-lines having the same input signal to one shared delay line.

A single-delay-line version can be defined as follows:

  linterp(d,x) = (1-d) * x + d * x';
  fdelay1(n,d,x) = delay(n,int(d),x) : linterp(frac(d));
Note that these definitions are not equivalent. While they are equivalent when the delay d is fixed, they diverge when int(d) changes from one sample to the next. In the dual-delay-line specification, the desired result is obtained, while in the single-delay-line case, x' becomes a one-sample delay of the old delay-line output instead of the new delay-line output. This inconsistency can potentially cause audible clicks when the tuning is rapidly varied.

A proper implementation of the single-delay-line case involves resetting the linear-interpolator state variable when the delay-length changes. Conceptually, the linear interpolator should be implemented as two delay-line taps with gains $(1-\eta)$ and $\eta$. This structure is produced by the Faust optimization rules from the dual-delay-line specification as above.

Linear delay-line interpolation works well in a digital waveguide string model as long as the modeled string is sufficiently damped. Specifically, the string damping must be sufficient to mask the changing roll-off in the amplitude response of the linear interpolator. In the case of very light damping (such as when simulating steel strings at normal audio sampling rates), certain notes (such as B-flat at a sample rate of 44.1 kHz) will jump out as ``buzzy'' when they correspond to a nearly integer delay-line length (fundamental frequencies close to the sampling rate divided by an integer). This artifact diminishes with oversampling factor, of course.


Next  |  Prev  |  Up  |  Top  |  REALSIMPLE Top

Download faust_strings.pdf

``Making Virtual Electric Guitars and Associated Effects Using Faust'', by Julius O. Smith III,
REALSIMPLE Project — work supported in part by the Wallenberg Global Learning Network .
Released 2013-08-22 under the Creative Commons License (Attribution 2.5), by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA