frame#
- class diffsptk.Frame(frame_length, frame_period, center=True, zmean=False, mode='constant')[source]#
See this page for details.
- Parameters:
- frame_lengthint >= 1
Frame length, \(L\).
- frame_periodint >= 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.
- zmeanbool
If True, perform mean subtraction on each frame.
- mode[‘constant’, ‘reflect’, ‘replicate’, ‘circular’]
Padding mode.
- forward(x)[source]#
Apply framing to given waveform.
- Parameters:
- xTensor [shape=(…, T)]
Waveform.
- Returns:
- outTensor [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.]])
- diffsptk.functional.frame(x, frame_length=400, frame_period=80, center=True, zmean=False, mode='constant')[source]#
Perform framing.
- Parameters:
- xTensor [shape=(…, T)]
Waveform.
- 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.
- zmeanbool
If True, perform mean subtraction on each frame.
- mode[‘constant’, ‘reflect’, ‘replicate’, ‘circular’]
Padding mode.
- Returns:
- outTensor [shape=(…, T/P, L)]
Framed waveform.