# delays.lib

This library contains a collection of delay functions. Its official prefix is `de`.

#### References

- https://github.com/grame-cncm/faustlibraries/blob/master/delays.lib

## Basic Delay Functions

### `(de.)delay`

Simple `d` samples delay where `n` is the maximum delay length as a number of samples. Unlike the `@` delay operator, here the delay signal `d` is explicitly bounded to the interval [0..n]. The consequence is that delay will compile even if the interval of d can't be computed by the compiler. `delay` is a standard Faust function.

#### Usage

    _ : delay(n,d) : _

Where:

- `n`: the max delay length in samples
- `d`: the delay length as a number of samples (integer)

### `(de.)fdelay`

Simple `d` samples fractional delay based on 2 interpolated delay lines where `n` is the maximum delay length as a number of samples. `fdelay` is a standard Faust function.

#### Usage

    _ : fdelay(n,d) : _

Where:

- `n`: the max delay length in samples
- `d`: the delay length as a number of samples (float)

### `(de.)sdelay`

s(mooth)delay: a mono delay that doesn't click and doesn't transpose when the delay time is changed.

#### Usage

    _ : sdelay(n,it,dt) : _

Where :

- `n`: the max delay length in samples
- `it`: interpolation time (in samples) for example 1024
- `dt`: delay time (in samples)

## Lagrange Interpolation

### `(de.)fdelaylti` and `(de.)fdelayltv`

Fractional delay line using Lagrange interpolation.

#### Usage

    _ : fdelaylt[i|v](order, maxdelay, delay, inputsignal) : _

Where `order=1,2,3,...` is the order of the Lagrange interpolation polynomial.

`fdelaylti` is most efficient, but designed for constant/slowly-varying delay. `fdelayltv` is more expensive and more robust when the delay varies rapidly.

NOTE: The requested delay should not be less than `(order-1)/2`.

#### References

- https://ccrma.stanford.edu/~jos/pasp/Lagrange_Interpolation.html
- fixed-delay case
- variable-delay case
- Timo I. Laakso et al., "Splitting the Unit Delay - Tools for Fractional Delay Filter Design", IEEE Signal Processing Magazine, vol. 13, no. 1, pp. 30-60, Jan 1996.
- Philippe Depalle and Stephan Tassart, "Fractional Delay Lines using Lagrange Interpolators", ICMC Proceedings, pp. 341-343, 1996.

### `(de.)fdelay[n]`

For convenience, `fdelay1`, `fdelay2`, `fdelay3`, `fdelay4`, `fdelay5` are also available where n is the order of the interpolation.

## Thiran Allpass Interpolation

Thiran Allpass Interpolation

#### Reference

- https://ccrma.stanford.edu/~jos/pasp/Thiran_Allpass_Interpolators.html

### `(de.)fdelay[n]a`

Delay lines interpolated using Thiran allpass interpolation.

#### Usage

    _ : fdelay[N]a(maxdelay, delay, inputsignal) : _

(exactly like `fdelay`)

Where:

- `N`=1,2,3, or 4 is the order of the Thiran interpolation filter, and the delay argument is at least N - 1/2.

#### Note

The interpolated delay should not be less than `N - 1/2`. (The allpass delay ranges from `N - 1/2` to `N + 1/2`.) This constraint can be alleviated by altering the code, but be aware that allpass filters approach zero delay by means of pole-zero cancellations. The delay range `[N-1/2`,`N+1/2]` is not optimal. What is?

Delay arguments too small will produce an UNSTABLE allpass!

Because allpass interpolation is recursive, it is not as robust as Lagrange interpolation under time-varying conditions (You may hear clicks when changing the delay rapidly.)

First-order allpass interpolation, delay d in [0.5,1.5]

#### Search

From here you can search these documents. Enter your search terms below.

#### Keyboard Shortcuts

Keys | Action
--- | ---
`?` | Open this help
`n` | Next page
`p` | Previous page
`s` | Search