Type Function Library media.* Return value Userdata Revision Release 2024.3703 Keywords media, event sound, sound, audio See also media.playEventSound()
Loads the event sound
media.newEventSound( audioFileName [, baseDir] )
String. The name of the audio file you want to load.
Constant. If specified, this argument is the directory where the sound file is located. If missing, the default is system.ResourceDirectory
. Other options include:
system.DocumentsDirectory
system.ApplicationSupportDirectory
system.TemporaryDirectory
system.CachesDirectory
Supported audio formats vary
There is no volume control API for event sounds. It is intended for alert sounds and the volume is controlled by the device’s hardware controls.
local soundID = media.newEventSound( "beep.mp3" ) local playBeep = function() media.playEventSound( soundID ) end timer.performWithDelay( 1000, playBeep, 0 )