Skip to main content

sinc_resample_kernel

Function sinc_resample_kernel 

Source
pub fn sinc_resample_kernel(orig: usize, new: usize) -> (Vec<f32>, usize)
Expand description

torchaudio _get_sinc_resample_kernel with its defaults (lowpass_filter_width = 6, rolloff = 0.99, sinc_interp_hann, dtype = None): the kernel is built in f64 and stored as f32. orig and new are already gcd-reduced. Returns (kernel [new][2·width + orig], width).

One detail is kept on purpose: the output phase -j / new is a float32 division in torch (torch.arange(0, -new, -1) is int64 and true division promotes it to the default dtype) before it meets the f64 tap grid.