Delayline

Allow to sample signal back in time. This delay-line has a twin write index, so that the read pointer can read a contiguous memory area. ____________________________________________________________________________________ | | _index | | readPointer = _index + half size | |

A Delayline is initialized with an internal length of N = numSamples,
in order to do a simple delay of N samples.
Internally, the delayline actually has 2 x nextPow2(N + 1) samples of storage.
So typically a delay line is initialized with maxDelaySamples + maxFrames (if buffering is used)..

Example:

import dplug.dsp.delayline;

void delaySampleBySample() // slower method, but easier to be correct { Delayline!float delayline; delayline.initialize(maxPossibleDelay); for (int n = 0; n < frames; ++n) { delayline.feedSample(inputn);

// desiredDelay = 0 would be the sample we just fed // the delayline with. delayedn = delayline.fullSample(desiredDelay); } }

void delayUsingReadPointer() // fastest method, but more confusing { Delayline!float delayline; delayline.initialize(maxFrames + maxPossibleDelay); delayline.feedBuffer(input.ptr, frames); const(float)* readPtr = d.readPointer() - desiredDelay - frames + 1; delayed[0..frames] = readPtr[0..frames]; // Caveats: frames <= maxFrames and desiredDelay <= maxPossibleDelay. }

Destructor

~this
~this()
Undocumented in source.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Functions

feedBuffer
void feedBuffer(const(T)[] incoming)
void feedBuffer(const(T)* incoming, size_t count)

Adds several samples at end of delay.

feedSample
void feedSample(T incoming)

Adds a new sample at end of delay.

initialize
void initialize(int numSamples)

Initialize the delay line. Can delay up to numSamples samples.

nextBuffer
void nextBuffer(const(T)* input, T* output, int frames)

Combined feed + sampleFull. Uses the delay line as a fixed delay of count samples.

nextSample
T nextSample(T incoming)

Combined feed + sampleFull. Uses the delay line as a fixed delay of count samples.

readPointer
const(T)* readPointer()
resize
void resize(int numSamples)

Resize the delay line. Can delay up to count samples. The state is cleared.

sampleFull
T sampleFull(int delay)

Random access sampling of the delay-line at integer points. Delay 0 = last entered sample with feed().

sampleFullBuffer
void sampleFullBuffer(int delayOfMostRecentSample, float* outBuffer, int frames)

Random access sampling of the delay-line at integer points, extract a time slice. Delay 0 = last entered sample with feed().

sampleHermite
T sampleHermite(float delay)

Random access sampling of the delay-line with a 3rd order polynomial.

sampleLinear
T sampleLinear(float delay)

Random access sampling of the delay-line with linear interpolation.

sampleSpline3
T sampleSpline3(float delay)

Third-order spline interpolation http://musicdsp.org/showArchiveComment.php?ArchiveID=62

sampleSpline4
T sampleSpline4(float delay)

4th order spline interpolation http://musicdsp.org/showArchiveComment.php?ArchiveID=60

Meta