• Studio

  • Studio API

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • AudioSource

    Inherits from: Behaviour

    AudioSource is a component used to play sounds. You can assign an AudioClip to an AudioSource to control sound playback, adjust volume, change pitch, loop sounds, and manage spatial effects for 3D audio.

    Properties

    volume

    number

    Manages the loudness of the audio playing through the AudioSource. Adjust this property to control volume levels.

    pitch

    number

    Controls the speed of sound playback. Adjusting the pitch changes the sound's speed and pitch.

    time

    number

    Sets or returns the current playback position in seconds, allowing for precise control over playback.

    Allows setting and retrieving the playback position in PCM samples for precise audio timing.

    Holds the AudioClip to be played, allowing for the assignment of sound to the AudioSource.

    isPlaying

    boolean

    Indicates if the AudioSource is currently playing sound, useful for checking audio status.

    isVirtual

    boolean

    Indicates whether the AudioSource is virtualized, which has minimal resource usage.

    loop

    boolean

    When true, the audio clip will play indefinitely in a loop, useful for background music or repeating sounds.

    When true, AudioSource ignores global volume controls, playing audio at its own volume level.

    Determines if the audio clip will start playing automatically when the script activates.

    Allows the AudioSource to keep playing despite a global pause, when set to true.

    panStereo

    number

    Controls the left and right stereo pan, aiding in achieving desired sound effects.

    Sets the level of 3D audio effect application on the audio playback.

    spatialize

    boolean

    Activates spatializer effect for immersive 3D audio when set to true.

    Applies spatial effects to the AudioSource for enhanced audio experience when true.

    Controls the mix of spatialized AudioSource into global reverb, enhancing audio depth.

    Bypasses applied effects, playing the original sound when true.

    Bypasses 3D spatialization effects when true, affecting volume and pitch directly.

    Allows bypassing Global Reverb Zones for direct sound play when true.

    Sets the amount of Doppler effect, changing sound frequency based on movement.

    spread

    number

    Controls audio spread across speakers in 3D playback, affecting sound directionality.

    priority

    number

    Determines the AudioSource's priority among others for managing active AudioSource objects and playback selection based on priority value.

    mute

    boolean

    Mutes the AudioSource when true, stopping any sound from being played.

    Sets the minimum distance for the AudioSource to start attenuating, controlling volume over distance.

    Defines the maximum distance where attenuation stops, setting the farthest point for audio volume reduction.

    Methods

    Starts playing the assigned audio clip, allowing for sound playback control.

    Returns

    void

    Plays the assigned audio clip after a delay, useful for timed sound effects.

    Parameters

    delay

    number

    The delay time in seconds before the audio clip starts playing.

    Returns

    void

    Schedules audio clip playback at a precise time, aiding in synchronized audio events.

    Parameters

    time

    number

    The time in seconds when the audio clip will start playing.

    Returns

    void

    Plays an audio clip once on demand, ignoring the AudioSource's regular clip.

    Parameters

    The audio clip to play once.

    Returns

    void

    Schedules the start time for audio clip playback, organizing audio in precise manner.

    Parameters

    time

    number

    The scheduled start time in seconds for the audio clip.

    Returns

    void

    Schedules a stop time for audio clip playback, useful for precise audio event control.

    Parameters

    time

    number

    The scheduled end time in seconds for the audio clip.

    Returns

    void

    Stops currently playing audio, useful for immediate sound halt.

    Returns

    void

    Pauses the audio playback, allowing for later resumption from the same point.

    Returns

    void

    Resumes paused audio playback from where it was stopped.

    Returns

    void

    Sets a float parameter for a spatializer effect attached to the AudioSource.

    Parameters

    index

    number

    The index of the parameter in the spatializer effect.

    value

    number

    The new value for the specified parameter.

    Returns

    boolean

    Sets a float parameter for an ambisonic decoder plugin attached to the AudioSource.

    Parameters

    index

    number

    The index of the parameter in the ambisonic decoder plugin.

    value

    number

    The new value for the specified parameter.

    Returns

    boolean

    Plays an AudioClip at a specified world position, as a static method.

    Parameters

    The AudioClip to be played.

    position
    Vector3

    The world position where the AudioClip will be played.

    Returns

    void

    Updated about 1 month ago

    PocketWorlds Icon

    © 2024 Pocket Worlds. All rights reserved.