Sound API Reference


A Sound represents a sound effect object and can be used to play back audio. Generally a Sound should be added to either a scene or the global app’s resources so that it can be managed by them.

Note that if you deploy your app using the Marmalade SDK as a native web app then the more powerful Marmalade audio system will be used to play back audio.

Public properties

  • name – The name of the sound, this name is used when searching for sound resources in a Scene’s resources or the the app’s global resources
  • parent – Parent container scene or app
  • location – The location of the sound file that is used to create the audio object
  • location2 – The location of the sound file that is used as a fall back if sound at location does not load
  • reuse – When set to false the generated sound Audio will be re-used, this can prevent sounds that are currently playing being replayed whilst currently being played but can help resolve audio playback issues
  • loop – If set to true then sound will be looped
  • preload – if set to true then this sound will be preloaded
  • loaded – If set to true then this resources has finished loading

Internal properties

  • snd – Local audio object


Sound(name, location, reuse) – Creates an instance of a Sound object.

  • name – Name of the sound
  • location – The sound file location
  • reuse – Mark the sound to be re-used

load() – Loads the sound

play() – Plays the sound

  • returns an audio object representing the playing sound

stop() – Stops playback of the sound

pause() – Pauses playback of the sound

destroy() – Removes the sound from the scene / app and destroys it


Load and play a sound effect

Known Issues

  • Sound effects cannot be preloaded on some version of iOS

1,090 total views, 1 views today