unframe#

class diffsptk.Unframe(frame_length, frame_period, *, center=True, window='rectangular', norm='none')[source]#

This is the opposite module to Frame().

Parameters:
frame_lengthint >= 1

Frame length, \(L\).

frame_peirodint >= 1

Frame period, \(P\).

centerbool

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.

window[‘blackman’, ‘hamming’, ‘hanning’, ‘bartlett’, ‘trapezoidal’, ‘rectangular’]

Window type.

norm[‘none’, ‘power’, ‘magnitude’]

Normalization type of window.

forward(y, out_length=None)[source]#

Revert framed waveform.

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

Framed waveform.

out_lengthint or None

Length of original signal, T.

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

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.]])
>>> unframe = diffsptk.Unframe(5, 2)
>>> z = unframe(y, out_length=x.size(0))
>>> z
tensor([1., 2., 3., 4., 5., 6., 7., 8., 9.])
diffsptk.functional.unframe(y, *, out_length=None, frame_length=400, frame_period=80, center=True, window='rectangular', norm='none')[source]#

Revert framed waveform.

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

Framed waveform.

out_lengthint >= 1 or None

Length of original signal, T.

frame_lengthint >= 1

Frame length, \(L\).

frame_peirodint >= 1

Frame period, \(P\).

centerbool

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.

window[‘blackman’, ‘hamming’, ‘hanning’, ‘bartlett’, ‘trapezoidal’, ‘rectangular’]

Window type.

norm[‘none’, ‘power’, ‘magnitude’]

Normalization type of window.

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

Waveform.

See also

frame window