快捷方式

逆譜圖

class torchaudio.transforms.InverseSpectrogram(n_fft: int = 400, win_length: ~typing.Optional[int] = None, hop_length: ~typing.Optional[int] = None, pad: int = 0, window_fn: ~typing.Callable[[...], ~torch.Tensor] = <built-in method hann_window of type object>, normalized: ~typing.Union[bool, str] = False, wkwargs: ~typing.Optional[dict] = None, center: bool = True, pad_mode: str = 'reflect', onesided: bool = True)[source]

建立一個逆譜圖,用於從譜圖中恢復音訊訊號。

This feature supports the following devices: CPU, CUDA This API supports the following properties: Autograd, TorchScript
引數:
  • n_fft (int, 可選) – FFT 大小,建立 n_fft // 2 + 1 個 bin。(預設值: 400)

  • win_length (intNone, 可選) – 視窗大小。(預設值: n_fft)

  • hop_length (intNone, 可選) – STFT 視窗之間的跳躍長度。(預設值: win_length // 2)

  • pad (int, 可選) – 訊號的雙邊填充。(預設值: 0)

  • window_fn (Callable[..., Tensor], 可選) – 一個函式,用於建立應用於/乘以每個幀/視窗的視窗張量。(預設值: torch.hann_window)

  • normalized (boolstr, 可選) – STFT 輸出是否按幅度歸一化。如果輸入為 str,可選值為 "window""frame_length",取決於歸一化模式。True 對應於 "window"。(預設值: False)

  • wkwargs (dictNone, 可選) – 視窗函式的引數。(預設值: None)

  • center (bool, 可選) – 譜圖中的訊號是否在兩側進行了填充,以便第 \(t\) 幀以時間 \(t \times \text{hop\_length}\) 為中心。(預設值: True)

  • pad_mode (string, 可選) – 控制當 centerTrue 時使用的填充方法。(預設值: "reflect")

  • onesided (bool, 可選) – 控制是否使用譜圖返回一半結果以避免冗餘。(預設值: True)

示例
>>> batch, freq, time = 2, 257, 100
>>> length = 25344
>>> spectrogram = torch.randn(batch, freq, time, dtype=torch.cdouble)
>>> transform = transforms.InverseSpectrogram(n_fft=512)
>>> waveform = transform(spectrogram, length)
使用 InverseSpectrogram 的教程
Audio Feature Augmentation

音訊特徵增強

音訊特徵增強
Speech Enhancement with MVDR Beamforming

使用 MVDR 波束形成進行語音增強

使用 MVDR 波束形成進行語音增強
forward(spectrogram: Tensor, length: Optional[int] = None) Tensor[source]
引數:
  • spectrogram (Tensor) – 維度為 (…, freq, time) 的音訊複數張量。

  • length (intNone, 可選) – 輸出波形的長度。

返回值:

維度 (…, time),原始訊號的最小二乘估計。

返回型別:

Tensor

文件

訪問 PyTorch 的全面開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源