- A Digital Delay Line
- Implementing Digital Delay Lines
- Simulating Sound Wave Propagation
- Wave Reflections and ``Echo''
- Tapped Delay Lines
- Feedforward Comb Filters
- Feedback Comb Filters
- Delay Line Interpolation

- A block diagram of a digital delay line is shown in Fig. 11 below. The length of the delay is given by the exponent of
*z*. - The input signal is given by
. For a delay line length of
*M*samples, the output is given by the relation

where for*n*< 0. - The functioning of a delay line can be visualized as in Fig. 12, assuming
*M*= 4 and a discrete-time unit impulse input signal defined as

- For every time step
*n*, the signal value in the last (right-most) memory location is output from the delay line, the remaining stored values are propagated to adjacent memory locations (to the right), and a new input sample is written to the first (left-most) memory location. - Thus, the sample value of 1 that is input at time
*n*= 0 will appear at the delay line output at time step*n*= 4. For this particular example, all subsequent inputs and outputs to the delay line are zeroes. In this way, the finite length impulse response of the length*M*= 4 digital delay line is given by*h*= {0, 0, 0, 0, 1}.

- A digital delay line is implemented by allocating a buffer of values in memory.
- The input and output points are represented by one or more pointers, which are incremented at each time step.
- Memory allocation can be a relatively time consuming operation in a realtime synthesis environment. Thus, in situations where the delay length may change over time, a large buffer of some maximum size is usually created during initialization.
- The Synthesis ToolKit in C++ (STK)
includes the class,
`Delay`, which provides non-interpolating delay functionality.`Delay`is a protected subclass of the`Filter`class. - The MSP object
`tapin~`implements a digital delay line (a buffer of memory) while the MSP object`tapout~`provides access to the contents of the delay line at arbitrary delay values. Note that these MSP objects take their delay values in milliseconds. - The MSP object
`delay~`implements a simple single-output delay line which can be used for delaying signals by a small number of samples. It's arguments are specified in terms of samples (not milliseconds). - The MSP object
`ezadc~`combines the a simple on/off button with the`adc~`object.

- Sound waves travel at a speed of approximately 345 meters per second. As a result, there is a time delay for sound to travel from an emitting source to a listener some distance away. This is more obvious when the distance between the sound source and listener is large, for example when observing fireworks from a few kilometers away.
- The time delay that results from this finite speed of propagation can be implemented with a delay line such as that shown in Fig. 11.
- A distance
*d*between source and listener will result in a time delay of*d*/*c*seconds (where*c*is the speed of sound propagation). - The delay line length can be determined as
*M*=*d*/ (*c T*), where*T*= 1 /*f*_{s}is the digital sample period (and*f*_{s}is the sampling rate in samples per second). - Note that the quantity
*c T*represents the distance traveled by sound in a single sample period, which is about 7 millimeters at a sample rate of 48000 Hz. - In this way, we can simulate the propagation of traveling-waves of sound over a specified distance.
- To simulate damped traveling-waves, we should include terms which represent the loss experienced over the distance traveled per unit delay, as represented in Fig. 13.
- To simulate damped traveling-waves and maintain efficiency, distributed damping constants or frequency-dependent attenuation characteristics can be ``commuted'' (assuming linearity) and implemented at a few (or just one) discrete points in the system.
- In reality, these losses will be frequency dependent (typically more losses at higher frequencies) and thus more accurately represented with appropriately designed lowpass digital filters.
- The amplitude of spherical pressure waves in air is proportional to 1/
*r*, where*r*is the distance of the wavefront from its source. This scaling coefficient is attributable to the spreading of a given energy over an expanding spherical surface (the surface area of a sphere is equal to and pressure amplitudes are proportional to the square root of energy). - On the other hand, guided planar wavefronts (such as in pipes) do not experience this attenuation because their wavefronts do not expand.

- If a traveling wave encounters a change in the physical properties of the medium through which it propagates, the wave will be perturbed where the change occurs. This perturbation generally involves some level of reflection, absorption and transmission at the boundary.
- For example, if a wavefront impinges on an ideally rigid surface, all of the wave energy will be reflected from the surface. However, if the surface is instead covered with a layer of absorbing material, only a portion of the wave energy will be reflected, with the remainder being trapped and damped within the material.
- The extent of such reflection can be characterized by a reflection coefficient (
*R*), which specifies the ratio of reflected to incident wave energy. Materials that are very reflective will have a value of*R*close to 1, while*R*will be close to zero for materials that are very absorptive. In general, the reflection coefficient will be frequency dependent. - Wave reflection from surfaces will also depend on the shape of the surface. If an acoustic wave encounters a rigid wall that is flat over at least several wavelengths in all directions, the wavefront will be reflected from that surface at an angle equal to its angle of incidence (referred to as ``specular'' reflection). On the other hand, a wall that is very uneven will reflect a wavefront in many directions (referred to as ``diffuse'' scattering).
- Figure 15 illustrates a source-listener arrangement with ``multipath'' wave propagation. If the time delay between the arrival of the direct and reflected waves is greater than about 50 milliseconds, the reflected sound will be perceived as an echo.
- The system of Fig. 16 (top) provides a signal processing block diagram to simulate the sound wave propagation of Fig. 15 using digital delay lines. The scale factors
*g*_{d}and*g*_{r}account for losses over the respective direct and reflected paths due to air absorption and spherical spreading. If the floor had a reflection coefficient less than one, this could also be included in the*g*_{r}factor. - The delay common to the two paths can be pulled out and implemented separately, as illustrated in the lower part of Fig. 16. In this case, the length of the delay line for the reflected path must be adjusted by subtracting from it the common delay length and its attenuation factor appropriately scaled.
*M*_{r}-*M*_{d}is found as:

- If the gain factors were only used to simulate spherical propagation scaling, the scaling for the reflected path in the lower plot of Fig. 16 would be calculated relative to
*d*as:

- The following MSP patch provides a cross-fade slider which controls the ``mix'' of direct to reflected sound.

- A tapped delay line is a delay line which provides access to its contents at arbitrary intermediate delay length values.
- The block diagram of Fig. 17 illustrates a tap delay line of total length
*M*_{2}samples and a tap located at a delay of*M*_{1}samples. In general, a tap delay line is implemented as a single buffer in memory. - Tap delay lines can be interpolating or non-interpolating.
- Tap delay lines can efficiently model multiple echoes from the same sound source and are useful in artificial reverberation.
- The MSP objects
`tapin~`and`tapout~`implement a tap delay line.

Comb filters get their name from the shape of their magnitude response and are important components of audio signal processing networks. It turns out that the acoustic echo model developed earlier is one instance of a feedforward comb filter.

- A feedforward comb filter is illustrated in Fig. 18.
The difference equation for this filter is given by:

*y*[*n*] =*b*_{0}*x*[*n*] +*b*_{M}*x*[*n*-*M*].

- The feedforward comb filter is equivalent to the echo simulator of Fig. 16 if
*b*_{0}= 1 and*b*_{M}=*g*. In this way, the feedforward comb filter is a computational physical model of a single discrete echo. - The magnitude response of a feedforward comb filter is shown in Fig. 19 for
*M*= 5,*b*_{0}= 1, and*b*_{M}= 0.1, 0.5, and 0.9.**Figure 19:**Magnitude response of a feedforward comb filter with*M*= 5,*b*_{0}= 1, and*b*_{M}= 0.1, 0.5, and 0.9. - The following MSP patch implements a feedforward comb filter.

- A feedback comb filter is illustrated in Fig. 20.
The difference equation for this filter is given by:

*y*[*n*] =*b*_{0}*x*[*n*] -*a*_{M}*y*[*n*-*M*].

For stability, the coefficient . - The feedback comb filter can be regarded as a computational physical model of a series of echoes, exponentially decaying and uniformly spaced in time.
- The magnitude response of a feedback comb filter is shown in Fig. 21 for
*M*= 5,*b*_{0}= 1, and*a*_{M}= -0.1, -0.5, and -0.9.**Figure 21:**Magnitude response of a feedback comb filter with*M*= 5,*b*_{0}= 1, and*a*_{M}= -0.1, -0.5, and -0.9. - The following MSP patch implements a feedback comb filter (note the 1 ms delay minimum using the
`tapout~`object). - The
`comb~`object in MSP implements a combined feedback/feedforward comb filter with inputs for various parameters (delay time and coefficients). This object has the same limitations with respect to delay length (1 ms minimum) as mentioned above.

- The previous discussion was based on the use of digital delay lines with integer sample delay lengths. In many contexts, it is necessary to compute the output of a delay line at fractional delay-line lengths.
- While signal values in a delay line are stored at integer multiples of the sample period
*T*, it is possible to apply interpolation techniques to approximate values between those in memory. - The most common interpolation techniques used in conjunction with delay lines are linear interpolation and allpass interpolation.
- The MSP
`tapout~`object provides interpolation when a signal input is connected to its left inlet. Note that the connection from a`tapin~`to a`tapout~`object is symbolic ... no actual signal is transmitted via that patchcord.

©2004-2017 McGill University. All Rights Reserved. Maintained by Gary P. Scavone. |