torchaudio.functional.resample(waveform: Tensor, orig_freq: int, new_freq: int, lowpass_filter_width: int = 6, rolloff: float = 0.99, resampling_method: str = 'sinc_interp_hann', beta: Optional[float] = None) Tensor[source]

Resamples the waveform at the new frequency using bandlimited interpolation. [Smith, 2020].

This feature supports the following devices: CPU, CUDA This API supports the following properties: Autograd, TorchScript


transforms.Resample precomputes and reuses the resampling kernel, so using it will result in more efficient computation if resampling multiple waveforms with the same resampling parameters.

  • waveform (Tensor) – The input signal of dimension (…, time)

  • orig_freq (int) – The original frequency of the signal

  • new_freq (int) – The desired frequency

  • lowpass_filter_width (int, optional) – Controls the sharpness of the filter, more == sharper but less efficient. (Default: 6)

  • rolloff (float, optional) – The roll-off frequency of the filter, as a fraction of the Nyquist. Lower values reduce anti-aliasing, but also reduce some of the highest frequencies. (Default: 0.99)

  • resampling_method (str, optional) – The resampling method to use. Options: ["sinc_interp_hann", "sinc_interp_kaiser"] (Default: "sinc_interp_hann")

  • beta (float or None, optional) – The shape parameter used for kaiser window.


The waveform at the new frequency of dimension (…, time).

Return type:


Tutorials using resample:
Speech Recognition with Wav2Vec2

Speech Recognition with Wav2Vec2

Speech Recognition with Wav2Vec2
ASR Inference with CTC Decoder

ASR Inference with CTC Decoder

ASR Inference with CTC Decoder
Audio Resampling

Audio Resampling

Audio Resampling


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources