AudioStreamPlayer

    Plays back audio non-positionally.

    Plays an audio stream non-positionally.

    To play audio positionally, use or AudioStreamPlayer3D instead of .

    Tutorials

    Methods

    get_playback_position ( )

    ( )

    void

    play ( from_position=0.0 )

    void

    seek ( to_position )

    void

    stop ( )

    • finished ( )

    Emitted when the audio stops playing.

    Enumerations

    enum MixTarget:

    • MIX_TARGET_STEREO = 0 —- The audio will be played only on the first channel.

    • MIX_TARGET_SURROUND = 1 —- The audio will be played on all surround channels.

    • MIX_TARGET_CENTER = 2 —- The audio will be played on the second channel, which is usually the center.

    Default

    false

    Setter

    set_autoplay(value)

    Getter

    is_autoplay_enabled()

    If true, audio plays when added to scene tree.


    Bus on which this audio is playing.

    Note: When setting this property, keep in mind that no validation is performed to see if the given name matches an existing bus. This is because audio bus layouts might be loaded after this property is set. If this given name can’t be resolved at runtime, it will fall back to "Master".


    • mix_target

    Default

    0

    Setter

    set_mix_target(value)

    Getter

    get_mix_target()

    If the audio configuration has more than two speakers, this sets the target channels. See MixTarget constants.


    • pitch_scale

    1.0

    Setter

    set_pitch_scale(value)

    Getter

    get_pitch_scale()

    The pitch and the tempo of the audio, as a multiplier of the audio sample’s sample rate.


    If true, audio is playing.


    • stream

    Setter

    set_stream(value)

    Getter

    get_stream()

    The AudioStream object to be played.


    • stream_paused

    Default

    false

    Setter

    set_stream_paused(value)

    Getter

    get_stream_paused()

    If true, the playback is paused. You can resume it by setting stream_paused to false.


    Volume of sound, in dB.

    Method Descriptions

    • float get_playback_position ( )

    Returns the position in the in seconds.


    Returns the object associated with this .


    • void play ( float from_position=0.0 )

    Plays the audio from the given from_position, in seconds.


    Sets the position from which audio will be played, in seconds.


    • void stop ( )