window#
- class diffsptk.Window(in_length, out_length=None, norm='power', window='blackman')[source]#
- See this page for details. - Parameters:
- in_lengthint >= 1 [scalar]
- Input length or window length, \(L_1\). 
- out_lengthint >= L1 [scalar]
- Output length, \(L_2\). If \(L_2 > L_1\), output is zero-padded. 
- norm[‘none’, ‘power’, ‘magnitude’]
- Normalization type of window. 
- window[‘blackman’, ‘hamming’, ‘hanning’, ‘bartlett’, ‘trapezoidal’, ‘rectangular’]
- Window type. 
 
 - forward(x)[source]#
- Apply a window function to given waveform. - Parameters:
- xTensor [shape=(…, L1)]
- Framed waveform. 
 
- Returns:
- yTensor [shape=(…, L2)]
- Windowed waveform. 
 
 - Examples - >>> x = torch.ones(5) >>> window = diffsptk.Window(5, out_length=7, window="hamming", norm="none") >>> y = window(x) >>> y tensor([0.0800, 0.5400, 1.0000, 0.5400, 0.0800, 0.0000, 0.0000])