Type Function
Library audio.*
Return value Number
Revision 2017.3077
Keywords audio, fade
See also audio.fadeOut()


This fades a playing sound in a specified amount to a specified volume. The audio will continue playing after the fade completes.

This function returns the number of channels fade is actually applied to.


When you fade the volume, you are changing the volume of the channel. This value is persistent and it's your responsibility to reset the volume on the channel if you want to use the channel again later (see audio.setVolume()).


audio.fade( [ { [channel=c] [, time=t] [, volume=v ] } ] )

This function takes a single table as a parameter, with the following optional keys:

channel (optional)

Number. The channel number you want to fade on. 1 to the maximum number of channels are valid channels. Specify 0 to apply fade to all channels.

time (optional)

Number. The amount of time (in milliseconds) over which you want the audio to fade. Omitting this parameter invokes a default fade time which is currently 1000 milliseconds.

volume (optional)

Number. The target volume you want to change (fade) to. Valid numbers are 0.0 to 1.0 where 1.0 is the max volume. If this parameter is omitted, the default value is currently 0.0.


audio.fade( { channel=1, time=5000, volume=0.5 } )