frame#
- class diffsptk.Frame(frame_length, frame_period, *, center=True, zmean=False, mode='constant')[source]#
See this page for details.
- 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.
- zmeanbool
If True, perform mean subtraction on each frame.
- mode[‘constant’, ‘reflect’, ‘replicate’, ‘circular’]
The padding method.
- forward(x)[source]#
Apply framing to the given waveform.
- Parameters:
- xTensor [shape=(…, T)]
The waveform.
- Returns:
- outTensor [shape=(…, T/P, L)]
The 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]#
Apply framing to the given waveform.
- Parameters:
- xTensor [shape=(…, T)]
The waveform.
- 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.
- zmeanbool
If True, perform mean subtraction on each frame.
- mode[‘constant’, ‘reflect’, ‘replicate’, ‘circular’]
The padding method.
- Returns:
- outTensor [shape=(…, T/P, L)]
The framed waveform.