Shortcuts

Fade

class torchaudio.transforms.Fade(fade_in_len: int = 0, fade_out_len: int = 0, fade_shape: str = 'linear')[source]

Add a fade in and/or fade out to an waveform.

This feature supports the following devices: CPU, CUDA This API supports the following properties: Autograd, TorchScript
Parameters:
  • fade_in_len (int, optional) – Length of fade-in (time frames). (Default: 0)

  • fade_out_len (int, optional) – Length of fade-out (time frames). (Default: 0)

  • fade_shape (str, optional) – Shape of fade. Must be one of: “quarter_sine”, "half_sine", "linear", "logarithmic", "exponential". (Default: "linear")

Example
>>> waveform, sample_rate = torchaudio.load("test.wav", normalize=True)
>>> transform = transforms.Fade(fade_in_len=sample_rate, fade_out_len=2 * sample_rate, fade_shape="linear")
>>> faded_waveform = transform(waveform)
Tutorials using Fade:
Music Source Separation with Hybrid Demucs

Music Source Separation with Hybrid Demucs

Music Source Separation with Hybrid Demucs
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