torchaudio.functional.resample¶
- 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 [原始碼]¶
使用帶限插值法,以新的頻率對波形進行重新取樣。 [Smith, 2020]。
注意
transforms.Resample
預先計算並重複使用重新取樣核心,因此如果使用相同的重新取樣參數重新取樣多個波形,使用它可以提高計算效率。- 參數:
waveform (Tensor) – 維度為 (…, time) 的輸入訊號
orig_freq (int) – 訊號的原始頻率
new_freq (int) – 期望的頻率
lowpass_filter_width (int, optional) – 控制濾波器的銳利度,數值越大,效果越銳利,但效率越低。(預設值:
6
)rolloff (float, optional) – 濾波器的滾降頻率,表示為奈奎斯特頻率的一部分。 較低的值會減少抗鋸齒,但也會減少一些最高頻率。(預設值:
0.99
)resampling_method (str, optional) – 要使用的重新取樣方法。選項:[
"sinc_interp_hann"
,"sinc_interp_kaiser"
] (預設值:"sinc_interp_hann"
)beta (float or None, optional) – 用於 kaiser 視窗的形狀參數。
- 返回:
新的頻率的波形,維度為 (…, time).
- 返回類型:
Tensor
- 使用
resample
的教學