• Studio

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • AudioService

    Manages and controls all aspects of audio playback, including music, sound effects, and voice within the game environment. Offers functionalities like playing, stopping, and adjusting audio properties.

    Methods

    Checks if any audio is currently playing.

    Returns

    boolean

    Returns true if audio is playing; otherwise, false.

    Retrieves the current music intensity level.

    Returns

    number

    Current intensity of the playing music.

    Gets the volume level music is ducked to during audio ducking.

    Returns

    number

    The volume level music is ducked to.

    Temporarily lowers the music volume for a specified duration.

    Parameters

    duration

    number

    How long the music volume is lowered.

    duckOutDuration

    number

    Time to transition music volume to the ducked level.

    duckInDuration

    number

    Time to restore music volume back to normal after ducking.

    Returns

    void

    Plays music using an AudioShader.

    Parameters

    The AudioShader used to play music.

    volume

    number

    The volume at which the music should be played.

    Returns

    void

    Plays music from a specified URL.

    Parameters

    url

    string

    The URL of the music to be played.

    volume

    number

    The volume at which the music should be played.

    Returns

    void

    Stops currently playing music, with an option to fade out.

    Parameters

    fadeOut

    boolean

    Whether the music should fade out instead of stopping abruptly.

    Returns

    void

    Plays an audio effect using an AudioShader.

    Parameters

    The AudioShader used to play the audio effect.

    Returns

    void

    Plays a sound effect globally, without spatialization.

    Parameters

    The AudioShader representing the sound to be played.

    volume

    number

    Volume of the sound.

    pitch

    number

    Pitch adjustment of the sound.

    spatialize

    boolean

    Whether the sound should be spatialized.

    loop

    boolean

    Whether the sound should loop.

    Returns

    AudioSource

    The AudioSource through which the sound is played.

    Plays a sound effect attached to a specific GameObject, allowing for spatial audio effects.

    Parameters

    The AudioShader used to play the sound.

    gameObject
    GameObject

    The GameObject to which the sound is attached, allowing it to emit sound from its location in the game world.

    volume

    number

    Volume at which the sound should be played.

    pitch

    number

    Pitch adjustment for the sound, allowing for higher or lower playback tones.

    spatialize

    boolean

    Whether the sound should be spatialized, giving it a position in the 3D space of the game.

    Returns

    AudioSource

    The AudioSource instance through which the sound is played, allowing for further manipulation.

    Stops playback of an audio source.

    Parameters

    The AudioSource instance that should be stopped.

    Returns

    void

    Updated 4 months ago

    PocketWorlds Icon

    © 2024 Pocket Worlds. All rights reserved.