unframe#
- class diffsptk.Unframe(frame_length, frame_period, center=True, norm='none', window='rectangular')[source]#
This is the opposite module to
Frame()
.- 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.
- norm[‘none’, ‘power’, ‘magnitude’]
Normalization type of window.
- window[‘blackman’, ‘hamming’, ‘hanning’, ‘bartlett’, ‘trapezoidal’, ‘rectangular’]
Window type.
- forward(y, out_length=None)[source]#
Revert framed waveform.
- Parameters:
- yTensor [shape=(…, T/P, L)]
Framed waveform.
- out_lengthint [scalar]
Length of original signal, T.
- Returns:
- xTensor [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.])