快捷方式

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 = amplitudegain 是一個正的振幅比。如果 gain_type = powergain 是一個功率(電壓平方)。如果 gain_type = dbgain 以分貝為單位。

  • gain_type (str, 可選) – 增益型別。以下之一:amplitude, power, db (預設值: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[source]
引數:

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

返回:

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

返回型別:

Tensor

文件

查閱 PyTorch 的完整開發者文件

檢視文件

教程

獲取適合初學者和高階開發者的深度教程

檢視教程

資源

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

檢視資源