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=(…, N, L)]
Framed waveform.
Examples
>>> x = torch.arange(1, 10) >>> frame = diffsptk.Frame(5, 3) >>> 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