espnet2.gan_svs.visinger2.ddsp.init_kernels
Less than 1 minute
espnet2.gan_svs.visinger2.ddsp.init_kernels
espnet2.gan_svs.visinger2.ddsp.init_kernels(win_len, win_inc, fft_len, win_type=None, invers=False)
Initializes the kernels for the signal processing tasks using Fourier basis.
This function creates a kernel based on the specified window length, window increment, FFT length, and window type. It generates a Fourier basis and can optionally compute the pseudoinverse of the kernel.
- Parameters:
- win_len (int) – The length of the window to be used for processing.
- win_inc (int) – The increment between consecutive windows (not used in this implementation but may be relevant for future extensions).
- fft_len (int) – The length of the FFT to be used.
- win_type (str , optional) – The type of window to apply (e.g., ‘hann’, ‘hamming’). If None, a rectangular window is used.
- invers (bool , optional) – If True, computes the pseudoinverse of the kernel. Defaults to False.
- Returns: A tuple containing: : - A tensor representing the initialized kernel of shape (2 * win_len, 1, win_len).
- A tensor representing the window of shape (1, win_len, 1).
- Return type: Tuple[torch.Tensor, torch.Tensor]
Examples
>>> kernel, window = init_kernels(win_len=256, win_inc=128, fft_len=512,
... win_type='hann')
>>> kernel.shape
torch.Size([512, 1, 256])
>>> window.shape
torch.Size([1, 256, 1])
NOTE
The output kernel is used in signal processing tasks, such as convolution with signals in the time domain. The choice of window type can significantly affect the performance of subsequent processing.