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.
- 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