Sound:echo([delay], [decay], [dry], [wet]) method


Apply an echo effect on the sound. Calling this method with an explicit nil will suppress the echo effect.

Parameters

[delay]

A number representing the echo delay in seconds, the time delay between the original sound and its echo.
The default value is 0.4 (the default).

[decay]

A number representing the echo delay in seconds, the time it takes for the echo to decay to zero after the sound has stopped emitting.
The default value is 0.3 (the default).

[dry]

A number representing the volume adjustment of the original ("dry") sound. The default value is 1.0

[wet]

A number representing the volume adjustment of the echo effect ("wet") sound. The default value is 1.0

Return value

This function returns no value.

Example

local audio = require "audio" local ui = require "ui" local win = ui.Window("Music player", "single", 320, 200) local file = sys.File("music.mp3") local ch = ui.Checkbox(win, "Echo effect") ch:center() win:status("Playing "..file.name) local sound = audio.Sound(file) sound:play() function ch:onClick() if ch.checked then sound:echo(0.5, 0.4) -- apply an echo effect else sound:echo(nil) -- suppress the echo effect end end win:show() while win.visible do ui.update() end