Vol¶
- class torchaudio.transforms.Vol(gain: float, gain_type: str = 'amplitude')[source]¶
Adjust volume of waveform.
- Parameters:
gain (float) – Interpreted according to the given gain_type: If
gain_type
=amplitude
,gain
is a positive amplitude ratio. Ifgain_type
=power
,gain
is a power (voltage squared). Ifgain_type
=db
,gain
is in decibels.gain_type (str, optional) – Type of gain. One of:
amplitude
,power
,db
(Default:amplitude
)
- Example
>>> waveform, sample_rate = torchaudio.load("test.wav", normalize=True) >>> transform = transforms.Vol(gain=0.5, gain_type="amplitude") >>> quieter_waveform = transform(waveform)