sm.audio

The audio manager is used to play sound effects in the game.

Note:

This manager does only produce sound for the local client. This is useful for small sound effects such as for GUI.

For more information about sound and particle effects that affect all players, see sm.effect.

Constants:

Functions:

  • getGlobalParameter
  • play
  • setGlobalParameter

  • sm.audio.soundList table

    Deprecated:

    Audio is deprecated, use Effect instead

    A table with all the names of available sounds in the game.


    sm.audio.getGlobalParameter(name)

    Client only

    Gets a named global parameter value from FMOD.

    Parameters:

    TypeNameDescription
    stringnameThe name.

    Returns:

    TypeDescription
    numberThe parameter value.

    sm.audio.play(sound, position?)

    Client only

    Plays a sound.

    If position is specified, the sound will play at the given coordinates in the world. Otherwise, the sound will play normally.

    For a list of available sounds to play, see sm.audio.soundList.

    Parameters:

    TypeNameDescription
    stringsoundThe sound to play.
    Vec3position?The world position of the sound. (Optional)

    sm.audio.setGlobalParameter(name, value)

    Client only

    Sets a named global parameter value in FMOD.

    Parameters:

    TypeNameDescription
    stringnameThe name.
    numbervalueThe parameter value.