Shortcuts

Vol

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

Adjust volume of waveform.

This feature supports the following devices: CPU, CUDA This API supports the following properties: Autograd, TorchScript
Parameters:
  • gain (float) – Interpreted according to the given gain_type: If gain_type = amplitude, gain is a positive amplitude ratio. If gain_type = power, gain is a power (voltage squared). If gain_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)
forward(waveform: Tensor) Tensor[source]
Parameters:

waveform (Tensor) – Tensor of audio of dimension (…, time).

Returns:

Tensor of audio of dimension (…, time).

Return type:

Tensor

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources