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

The frame length in samples, \(L\).

frame_periodint >= 1

The frame period in samples, \(P\).

centerbool

If True, pad the input on both sides so that the frame is centered.

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

The window type.

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

The normalization type of the window.

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

Revert the framed waveform to the unframed waveform.

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

The framed waveform.

out_lengthint or None

The length of the original waveform, \(T\).

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

The unframed 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_period=80, center=True, window='rectangular', norm='none')[source]#

Revert framed waveform.

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

The framed waveform.

out_lengthint >= 1 or None

The length of the original waveform, \(T\).

frame_peirodint >= 1

The frame period in samples, \(P\).

centerbool

If True, pad the input on both sides so that the frame is centered.

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

The window type.

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

The normalization type of the window.

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

The unframed waveform.

See also

frame window