Vol¶ class torchaudio.transforms.Vol(gain: float, gain_type: str = 'amplitude')[source]¶ 調整波形的音量。 參數: gain (float) – 根據給定的 gain_type 進行解釋:如果 gain_type = amplitude,則 gain 是一個正振幅比。 如果 gain_type = power,則 gain 是一個功率(電壓的平方)。 如果 gain_type = db,則 gain 以分貝為單位。 gain_type (str, optional) – 增益類型。選項包括: 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[原始碼]¶ 參數: waveform (Tensor) – 音訊張量,維度為 (…, time)。 回傳值: 音訊張量,維度為 (…, time)。 回傳類型: Tensor