Skip to content

Audio

Namespace Audio for global sound and music. Component-level audio functions are in Component → Audio.

Audio.playSound

Audio.playSound(path, volume?, loop?) -> bool

volume defaults to 1, loop to false.

Audio.playMusic

Audio.playMusic(path, volume?, loop?) -> bool

Audio.stopSound

Audio.stopSound(path) -> nil

Swallows errors if the asset is missing.

Audio.stopMusic

Audio.stopMusic(path) -> nil

Swallows errors if the asset is missing.

Audio.stopAllSounds

Audio.stopAllSounds() -> nil

Audio.stopAllMusic

Audio.stopAllMusic() -> nil

Audio.setSoundVolume

Audio.setSoundVolume(path, volume) -> bool

Audio.setMusicVolume

Audio.setMusicVolume(path, volume) -> bool

Audio.isSoundPlaying

Audio.isSoundPlaying(path) -> bool

Audio.isMusicPlaying

Audio.isMusicPlaying(path) -> bool

Volumes are clamped to 0..1.