..Help .Objects

Delay

Provides up to 1024 samples of delay.

Pins
io letter name unit description
in X input auto input signal
D delay samples number of samples to delay
R recycle percent feedback amount
out = auto delayed signal plus recycle

Parameters
name option key description
interpolate always i See notes below

Notes
When the D input has non-changing data, it will be rounded to the closest integer sample. So D=15.6 will result in a 16 sample delay. This behavior can be overridden by useing the interpolate always setting. Interpolatation is by linear fit which will result in harmonic distortion that increases with higher frequencies.
The D input is always treated as a positive number. For example, setting D to -125 results in a delay of +125 samples.

The R input may positive or negative. Be careful of recycle values close to or above 1, as they will result in uncontrollable feedback.

The R input causes the delay to act as a resonator. This means that input signals with frequencies that are integer harmonics of the delay time will cause the object to resonate.
The natural frequency of the delay can be calculated as Hz=44100/samples. Or as value=1/(D*512)

Recursive Filter Transformations

Many types of recursive filters can be implemented with the delay object. Examples of these are often shown in DSP texts as flow or network diagrams. It is common to see z-1 or z-t terms used in a feedback path, indicating a delay of one more samples fed back into the input of the delay. Trying to do this directly in ABox will not give the correct results. Connecting the output to the input results in z-1024.

In many cases, however, it is possible to factor terms from the recursive equations and precalculate them before injecting into the resonant delay. The steps involved are shown below and make use of the expansion of the resonant delay equation:
y[n] = x[n-d] + y[n-d] * R 
y[n-d] = x[n-2d] + y[n-2d] * R
y[n-2d] = x[n-3d] + y[n-3d] * R
...
y[n] = ∑ from m=1 to ∞ of Rm-1 * x[n-m*d]
Following is an example of how this can be done.

Task: Synthesize an all-pass filter using the recursive equation:

y[n] = x[n-d] + R * ( y[n-d] - x[n] )
Here is how it would look if there were no feedback latency (this circuit will not work correctly):

Transforming the above circuit into one that does work correctly requires a little algebra. The expressions can get to be somewhat lengthy, patience or a symbolic algebra program is helpful.

1) Expand the origonal all-pass equation a few iterations by successively replacing n with n-d.

y[n   ] = x[n- d] + R * ( y[n- d] - x[n   ] )
y[n- d] = x[n-2d] + R * ( y[n-2d] - x[n- d] )
y[n-2d] = x[n-3d] + R * ( y[n-3d] - x[n-2d] )
y[n-3d] = x[n-4d] + R * ( y[n-4d] - x[n-3d] )
y[n-4d] = x[n-5d] + R * ( y[n-5d] - x[n-4d] )
y[n-5d] = ....
2) Back substitute the expanded equations into their previous equations.
y[n] = x[n-d] + R * 
        ( x[n-2d] + R * 
         ( x[n-3d] + R * 
          ( x[n-4d] + R * 
           ( x[n-5d] + R * 
            ( ... - x[n-4d] )
           - x[n-3d] )
          - x[n-2d] )
         - x[n- d] )
        - x[n   ] )
3) Expand the expression taking care to maintain both xy indices and powers of R. At same time, or as a subsequent step if you prefer, group the expressions so that like n-m*d terms are on the same line.
y[n] =                - R1 * x[n-0d]
       + R0 * x[n-1d] - R2 * x[n-1d]
       + R1 * x[n-2d] - R3 * x[n-2d]
       + R2 * x[n-3d] - R4 * x[n-3d]
       + R3 * x[n-4d] - R5 * x[n-4d]
       + R4 * x[n-5d] - ...
4) By inspection we see that after the second line each new term is sucessively multiplied by R, exactly as we see in the resonant delay equation. Thus we can factor the second line, pre-calculate it and inject it into the delay.
 x[n] * (1-R2) 
which, after running through the delay once, come out as
 x[n-d] * (1-R2) 
which is equivalent to the second line in #3
Note that we still need to add the first term to the results of the delay. This gives us the following circuit:




©1999-2008 Andy J Turner
All rights reserved.