frame#

class diffsptk.Frame(frame_length, frame_period, center=True, zmean=False)[source]#

See this page for details.

Parameters:
frame_lengthint >= 1 [scalar]

Frame length, \(L\).

frame_peirodint >= 1 [scalar]

Frame period, \(P\).

centerbool [scalar]

If True, assume that the center of data is the center of frame, otherwise assume that the center of data is the left edge of frame.

zmeanbool [scalar]

If True, perform mean subtraction on each frame.

forward(x)[source]#

Apply framing to given waveform.

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

Waveform.

Returns:
yTensor [shape=(…, T/P, L)]

Framed waveform.

Examples

>>> x = diffsptk.ramp(1, 9)
>>> frame = diffsptk.Frame(5, 2)
>>> y = frame(x)
>>> y
tensor([[0., 0., 1., 2., 3.],
        [1., 2., 3., 4., 5.],
        [3., 4., 5., 6., 7.],
        [5., 6., 7., 8., 9.],
        [7., 8., 9., 0., 0.]])

See also

unframe window spec