快捷鍵

InverseSpectrogram

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, optional) – FFT 的大小,建立 n_fft // 2 + 1 個 bins。(預設:400

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

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

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

  • window_fn (Callable[..., Tensor], 選填) – 一個建立視窗張量的函數,該張量會應用/乘到每個 frame/window。(預設值:torch.hann_window)

  • normalized (boolstr, 選填) – STFT 輸出是否已通過幅度進行標準化。如果輸入為 str,則選項為 "window""frame_length",取決於標準化模式。True 映射到 "window"。(預設值:False)

  • wkwargs (dictNone, 選填) – 視窗函數的參數。(預設值:None)

  • center (bool, 選填) – 是否在頻譜圖中對信號進行雙邊填充,以便第 \(t\) 個 frame 以時間 \(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 的完整開發者文件

檢視文件

教學

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

檢視教學

資源

尋找開發資源並取得您的問題解答

檢視資源