快捷鍵

Vol

class torchaudio.transforms.Vol(gain: float, gain_type: str = 'amplitude')[source]

調整波形的音量。

This feature supports the following devices: CPU, CUDA This API supports the following properties: Autograd, TorchScript
參數:
  • gain (float) – 根據給定的 gain_type 進行解釋:如果 gain_type = amplitude,則 gain 是一個正振幅比。 如果 gain_type = power,則 gain 是一個功率(電壓的平方)。 如果 gain_type = db,則 gain 以分貝為單位。

  • gain_type (str, optional) – 增益類型。選項包括: amplitudepowerdb (預設值:amplitude

範例
>>> waveform, sample_rate = torchaudio.load("test.wav", normalize=True)
>>> transform = transforms.Vol(gain=0.5, gain_type="amplitude")
>>> quieter_waveform = transform(waveform)
forward(waveform: Tensor) Tensor[原始碼]
參數:

waveform (Tensor) – 音訊張量,維度為 (…, time)

回傳值:

音訊張量,維度為 (…, time)

回傳類型:

Tensor

文件

存取 PyTorch 的完整開發者文件

檢視文件

教學

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

檢視教學課程

資源

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

檢視資源