Engee documentation

Variable Fractional Delay

Delays the input signal by a time-varying fractional number of samples.

blockType: VariableFractionalDelay

Path in the library:

/Signal Operations/Signal Operations/Variable Fractional Delay

Description

The Variable Fractional Delay block delays the input signal by the specified number of fractional samples on each channel of the input signal. The block can also simultaneously calculate multiple delayed versions of the same signal.

When the delay has a fractional value, the block interpolates the input signal to produce new samples at non-integer sampling intervals. The block supports time-varying delay values. That is, the delay value can change within a frame from sample to sample.

The block assumes that the input values on the Delay port are between and . - is the value of the parameter Maximum delay (Dmax) in samples. If the delay value is greater than , it is replaced by , is 0.

When selecting acceptable Delay values for the interpolation mode. Farrow additional factors must be considered. For details, see Farrow interpolation method.

Ports

Input

# In — input signal
vector | matrix

Details

An input signal specified as a vector or matrix. The input signal must have the same data type as the delay signal on the Delay input.

Data types

Float16 | Float32 | Float64 | Int8 | Int16 | Int32 | Int64 | UInt8 | UInt16 | UInt32 | UInt64 | Fixed-point

Complex numbers support

Yes

# Delay — delay signal
scalar | vector | matrix | array N on D

Details

A delay signal specified as a scalar, vector, matrix, or array N on D. The delay can be an integer or a fractional number. The block interpolates the signal to produce new samples at non-integer sampling intervals. The signal at the Delay input must have the same data type as the signal at the In input.

The table below shows the effect of the input delay signal size on the input data when Input processing is set to Columns as channels (frame based).

Input signal Delay signal Output signal Effect of delay signal on output signal

at (one channel with frame size equal to )

scalar

at

One delay value applied to the input channel.

at (one channel with frame size equal to )

at

at

A corresponding delay value is applied to each signal reference.

at (one channel with frame size equal to )

at

at

Each column in the output data represents an input signal with a corresponding delay. The amount of delay is given by the corresponding element of the input delay vector.

at ( one channel with frame size equal to )

at

at

In addition, the delay varies in each frame from sample to sample.

at ( channels with frame size equal to )

scalar

at

One delay value applied to all input channels.

at ( channels with frame size equal to )

at

at

Individual delay value for each input channel.

at ( channels with frame size equal to )

at

at

The delay value varies within a frame from sample to sample. The same set of delay values for all channels.

at ( channels with frame size equal to )

at

at

The delay value varies within a frame from reference to reference. Different delay values for each input channel.

Example 1

[2 3 4 5]

Example 2

[2.5]

Example 3.

[5.6]

Data types

Float16 | Float32 | Float64 | Int8 | Int16 | Int32 | Int64 | UInt8 | UInt16 | UInt32 | UInt64 | Fixed-point

Complex numbers support

No

Output

# OUT_1 — delayed output signal
vector | matrix

Details

A processed output signal returned as a vector or matrix. The data type and complexity of the output corresponds to the data type and complexity of the input port In.

The table below shows the effect of the input delay signal size on the input data when Input processing is set to Columns as channels (frame based).

Input signal Delay signal Output signal Effect of delay signal on output signal

at (one channel with frame size equal to )

scalar

at

One delay value applied to the input channel.

at (one channel with frame size equal to )

at

at

A corresponding delay value is applied to each signal reference.

at (one channel with frame size equal to )

at

at

Each column in the output data represents an input signal with a corresponding delay. The amount of delay is given by the corresponding element of the input delay vector.

at ( one channel with frame size equal to )

at

at

In addition, the delay varies in each frame from sample to sample.

at ( channels with frame size equal to )

scalar

at

One delay value applied to all input channels.

at ( channels with frame size equal to )

at

at

Individual delay value for each input channel.

at ( channels with frame size equal to )

at

at

The delay value varies within a frame from sample to sample. The same set of delay values for all channels.

at ( channels with frame size equal to )

at

at

The delay value varies within a frame from reference to reference. Different delay values for each input channel.

Example 1

[0 0 0 0;0 0 0 0;1 0 0 0;5 2 0 0;2 1 3 0;1 6 4 4]

Example 2

[0 0 0 0;0 0 0 0;0.5 1.0 1.5 2.0;3 1.5 3.5 3.0;3.5 3.5 3.0 2.5;1.5 4.0 2.5 2.5]

Example 3

[0 0 0 0;0 0 0 0;0 0 0 0;0 0 0 0;0 0 0 0;0.4 0.8 1.2 1.6]

Data types

`Float16 | Float32 | Float64 | Int8 | Int16 | Int32 | Int64 | UInt8 | UInt16 | UInt32 | UInt64 | Fixed-point

Complex numbers support

Yes

Parameters

Main

# Interpolation mode — interpolation method
Linear | Farrow

Details

Specify the interpolation method. Using this method, the unit interpolates the signal to produce new samples at non-integer sampling intervals. Options to select:

  • Linear - linear interpolation. In this mode, the unit stores of the last samples that the In input port receives for each channel, where is the value of the parameter Maximum delay (Dmax) in samples.

  • Farrow - Lagrange method. In this mode, the block stores of the last samples received at the In port for each channel, where is the value of the parameter Farrow filter length (N).

Values

Linear | Farrow

Default value

Linear

Program usage name

InterpolationMode

Tunable

No

Evaluatable

No

# Farrow filter length (N) — Farrow filter length
Int64 integer

Details

The length of the FIR filter implemented using the Farrow structure. If the length is 2, the filter performs linear interpolation.

Dependencies

To use this parameter, set the parameters Interpolation mode to the value of Farrow.

Default value

4

Program usage name

FarrowFilterLength

Tunable

No

Evaluatable

Yes

# Maximum delay (Dmax) in samples — maximum delay
Int64 integer

Details

The maximum delay a block can produce is . Delay values exceeding this maximum are truncated to .

Example 1

100

Example 2.

30

Default value

100

Program usage name

MaximumDelay

Tunable

No

Evaluatable

Yes

# Input processing — input processing method
Columns as channels (frame based) | Elements as channels (sample based)

Details

Specify how the block should process the input data. You can set this parameter to a value:

  • Columns as channels (frame based) (By default) - If you select this method, the block treats each column of input data as a separate channel. The block treats each of the columns of the input signal as independent channels containing consecutive samples.

    The signal on the Delay input port contains floating point values that determine the number of samples of the input signal to which the delay will be applied.

    The dimensionality of the Delay port signal determines the signal processing method:

    • If the signal on the Delay port is a scalar, it is used to delay all samples in each channel evenly.

    • If the signal at the Delay port is a column vector of length , then each sample of the input signal corresponds to a different delay value. In case of multi-channel input, the same delay vector is applied to each channel of the input signal.

    • If the signal on the Delay port is a string of length , then each element of the delay string corresponds to a different channel of the input signal.

    • If the signal on the Delay port is a matrix М to , it contains different delays for each corresponding element of the input signal.

    For example, if is a matrix of size М by , [v(1) v(2) …​ v(Mi)], then the delay v(1) is applied to the first sample of the input signal, v(2) to the second, and so on. The block applies the set of fractional delays contained in , equally to each channel of the multichannel input.

  • Elements as channels (sample based) - If this method is selected, the block treats each element of the input as a separate channel. The block treats each element of the -dimensional array of inputs, , as an independent channel. The input signal on the Delay port, , must be either a -dimensional array of the same dimensionality as the input , or a scalar value such that .

    For example, consider the input matrix to . The block treats each of the elements of the matrix as independent channels. The input to the Delay port can be a matrix of by floating-point values in the range , defining the number of sample intervals to delay each input channel, or it can be a scalar floating-point value, , by which to delay all channels equally.

Values

Columns as channels (frame based) | Elements as channels (sample based)

Default value

Columns as channels (frame based)

Program usage name

InputProcessing

Tunable

No

Evaluatable

No

# Initial conditions — initial values
Scalar / array of real and/or complex numbers

Details

Specify the values that are in the block memory at the beginning of the simulation. The size of this parameter determines whether the initial values at the block output are fixed or time-varying. The block treats each of input columns as a frame containing consecutive samples from an independent channel.

For an input matrix to you can set the parameters as follows:

  • Scalar value to specify fixed initial conditions. The unit will fill each count of each channel in its internal memory with the specified value.

  • Time-varying initial conditions, which depend on the interpolation method. To set different time-varying initial conditions for each channel, set this parameter as follows:

    • Set the parameters Initial conditions to an array of size by by , where is the value of the parameter Maximum delay (Dmax) in samples.

Example 1

4

Example 2.

randn(1,3,104).

Default value

0

Program usage name

InitialConditions

Tunable

No

Evaluatable

Yes

# Disable direct feedthrough by increasing minimum possible delay by one — direct passage shutdown
Logical

Details

Select this check box to disable forward pass by increasing the minimum possible delay value.

If you set the parameters Input processing to frame size - 1. Columns as channels (frame based), then the block increases the minimum possible delay value by frame size - 1. Similarly, if you set the parameters Input processing to a value of Elements as channels (sample based), the block increases the minimum possible delay value by one count.

Setting this checkbox allows the block Variable Fractional Delay to be used in feedback circuits.

Default value

false (switched off)

Program usage name

DisableDirectFeedthrough

Tunable

No

Evaluatable

No

# For small input delay values — actions at low values of input delay
Clip to the minimum value necessary for centered kernel | Use off-centered kernel

Details

Specify the block behaviour when input delay values are too small for core centering using one of the following options:

  • Clip to the minimum value necessary for centered kernel - the block increases to the smallest value necessary to centre the core.

  • Use off-centered kernel - the block stores values and calculates interpolated values using the Farrow filter with a shifted kernel.

Dependencies

To use this parameter, set the Interpolation mode parameters to Farrow.

Values

Clip to the minimum value necessary for centered kernel | Use off-centered kernel

Default value

Clip to the minimum value necessary for centered kernel

Program usage name

SmallInputDelay

Tunable

No

Evaluatable

No

Algorithms

The value of the delay signal set on the Delay port serves as an index to the block memory, , which stores at least of the last samples received on the In port for each channel.

For example, an integer delay 5 on a scalar input sequence retrieves and outputs the fifth input sample from the block memory, . The block calculates fractional delays by interpolating between the stored samples. The block uses a linear method to interpolate signal values at non-integer sampling intervals.

Linear interpolation method

Details

For non-integer delays at each sampling period, the linear interpolation method uses the two samples in memory closest to the specified delay to calculate a value for the sample at that point.

For vector input data, the output vector, , is calculated using the following relationship:





where

  • - is the index of the current reference;

  • - fractional part of the delay;

  • - integer part of delay;

  • - fractional part of delay;

  • - input data vector;

  • - output data vector;

  • , - two samples in memory nearest to the specified delay;

  • - distance, in samples, between the current index and the nearest point in the interpolation line.

The block stores the last samples received as input for each channel, where is the maximum specified delay. represents the stored samples.

Farrow interpolation method

Details

In the Farrow interpolation mode, the block stores of the last samples received at the input for each channel, where is the specified Farrow filter length.

The algorithm uses the Lagrange method to interpolate values.

To increase the minimum possible delay value, select the checkbox Disable direct feedthrough by increasing minimum possible delay by one. Checking this box prevents algebraic loops from occurring when you use the block in a feedback circuit.

To determine the behaviour when the input delay value is too low for core centering (less than ), use the parameters For small input delay values:

  • Clip to the minimum value necessary for centered kernel - block increases small values of input delay to the smallest value needed to centre the core. This increases , but gives more accurate interpolation values.

  • Use off-centered kernel - fractional delays are calculated using a Farrow filter with the kernel off-centre. This mode does not increase , but the results for input delay values less than are less accurate than the results obtained by kernel centring.

See also