快捷鍵

TimeStretch

class torchaudio.transforms.TimeStretch(hop_length: Optional[int] = None, n_freq: int = 201, fixed_rate: Optional[float] = None)[原始碼]

在時間上延展 stft,而不會針對給定的速率修改音調。

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

SpecAugment [Park et al., 2019] 中提出。

參數:
  • hop_length (intNone選用) – STFT 視窗之間的跳躍長度。(預設值:n_fft // 2,其中 n_fft == (n_freq - 1) * 2

  • n_freq (int選用) – stft 的濾波器組數量。(預設值:201

  • fixed_rate (floatNone選用) – 加速或減速的速率。如果未提供 None,則速率必須傳遞到 forward 方法。(預設值:None

注意

預期的輸入是原始的複數值頻譜圖。

範例
>>> spectrogram = torchaudio.transforms.Spectrogram(power=None)
>>> stretch = torchaudio.transforms.TimeStretch()
>>>
>>> original = spectrogram(waveform)
>>> stretched_1_2 = stretch(original, 1.2)
>>> stretched_0_9 = stretch(original, 0.9)
The visualization of stretched spectrograms.
使用 TimeStretch 的教學
Audio Feature Augmentation

音訊特徵擴增

音訊特徵擴增
forward(complex_specgrams: Tensor, overriding_rate: Optional[float] = None) Tensor[原始碼]
參數:
  • complex_specgrams (Tensor) – 維度為 (…, freq, num_frame) 且具有複數 dtype 的張量。

  • overriding_rate (floatNone選用) – 套用於此批次的加速。如果未傳遞速率,則使用 self.fixed_rate。(預設值:None

回傳值:

延展的頻譜圖。產生的張量與輸入頻譜圖具有對應的複數 dtype,並且影格數更改為 ceil(num_frame / rate)

回傳類型:

Tensor

文件

存取 PyTorch 的完整開發者文件

查看文件

教學

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

查看教學

資源

尋找開發資源並獲得問題解答

查看資源