delay#

class diffsptk.Delay(start, keeplen=False, dim=-1)[source]#

See this page for details.

Parameters:
startint

Start point, \(S\). If negative, advance signal.

keeplenbool

If True, output has the same length of input.

dimint

Dimension along which to shift the tensors.

forward(x)[source]#

Delay signal.

Parameters:
xTensor [shape=(…, T, …)]

Signal.

Returns:
outTensor [shape=(…, T-S, …)] or [shape=(…, T, …)]

Delayed signal.

Examples

>>> x = diffsptk.ramp(1, 3)
>>> delay = diffsptk.Delay(2)
>>> y = delay(x)
>>> y
tensor([0., 0., 1., 2., 3.])
diffsptk.functional.delay(x, start=0, keeplen=False, dim=-1)[source]#

Delay signal.

Parameters:
xTensor [shape=(…, T, …)]

Signal.

startint

Start point, \(S\). If negative, advance signal.

keeplenbool

If True, output has the same length of input.

dimint

Dimension along which to shift the tensors.

Returns:
outTensor [shape=(…, T-S, …)] or [shape=(…, T, …)]

Delayed signal.