快捷鍵

torchaudio.functional.phase_vocoder

torchaudio.functional.phase_vocoder(complex_specgrams: Tensor, rate: float, phase_advance: Tensor) Tensor[source]

給定一個 STFT 張量,在不改變音調的情況下,按 rate 因子加速時間。

This feature supports the following devices: CPU, CUDA This API supports the following properties: Autograd, TorchScript
參數:
  • complex_specgrams (Tensor) – 維度為 (…, freq, num_frame) 的複數 dtype 張量。

  • rate (float) – 加速因子

  • phase_advance (Tensor) – 每個 bin 中的預期相位前進。維度為 (freq, 1)

返回:

拉伸的頻譜圖。結果張量與輸入頻譜圖具有相同的 dtype,但幀數更改為 ceil(num_frame / rate)

返回類型:

Tensor

範例
>>> freq, hop_length = 1025, 512
>>> # (channel, freq, time)
>>> complex_specgrams = torch.randn(2, freq, 300, dtype=torch.cfloat)
>>> rate = 1.3 # Speed up by 30%
>>> phase_advance = torch.linspace(
>>>    0, math.pi * hop_length, freq)[..., None]
>>> x = phase_vocoder(complex_specgrams, rate, phase_advance)
>>> x.shape # with 231 == ceil(300 / 1.3)
torch.Size([2, 1025, 231])

文件

訪問 PyTorch 的完整開發者文檔

查看文檔

教學

為初學者和進階開發者取得深入的教學

查看教學

資源

尋找開發資源並獲得解答

查看資源