AudioFade

AudioFade[audio]

returns audio in which the beginning and end of audio are faded.

AudioFade[audio,t]

fades the first and last t seconds of audio.

AudioFade[audio,{t1,t2}]

fades t1 seconds at the beginning and t2 seconds at the end.

Details and Options

  • AudioFade fades in the signal by gradually increasing the volume of the signal from 0 to the full amplitude of the signal at the beginning, and similarly fades out the end of the signal.
  • Fading a signal can be used to remove clicks when the audio is played back by avoiding potential discontinuities.
  • AudioFade[audio] is equivalent to AudioFade[audio,.001].
  • The shape of the ramp can be specified using a Method option. Possible settings are:
  • "Cosine"cosinusoidal fade
    "Exp"exponential fade
    "Linear"linear fade
    "Log"logarithmic fade
    "Rounded"rounded fade
    "SCurve"sinusoidal fade (default)

Examples

open allclose all

Basic Examples  (2)

Fade in a sinusoidal audio signal:

Plot the waveforms of the original and resulting signals:

Specify different fading times for the beginning and end of the signal using exponential fading:

Scope  (2)

The fade time can be specified as a time quantity:

Specify the fade time for beginning and end independently:

Specify the number of samples to be faded:

Options  (2)

Method  (2)

By default, a sinusoidal curve is used to add the fade:

Specify the fade shape:

Applications  (2)

AudioFade is useful to avoid clicks due to sudden phase jumps when joining multiple audio objects:

Without fading, there is a sudden jump at the joining point:

Eliminate the jump:

Use AudioFade to create a sound with a slow attack time:

Introduced in 2016
 (11.0)