AudioStreamPlayer2D

Inherits: Node2D < CanvasItem < Node < Object

Plays audio in 2D.

Description

Plays audio that dampens with distance from screen center.

Tutorials

Methods

floatget_playback_position ( )
AudioStreamPlaybackget_stream_playback ( )
voidplay ( float from_position=0.0 )
voidseek ( float to_position )
voidstop ( )

Signals

  • finished ( )

Emitted when the audio stops playing.

Property Descriptions

Default1
Setterset_area_mask(value)
Getterget_area_mask()

Areas in which this sound plays.


Default1.0
Setterset_attenuation(value)
Getterget_attenuation()

Dampens audio over distance with this as an exponent.


Defaultfalse
Setterset_autoplay(value)
Getteris_autoplay_enabled()

If true, audio plays when added to scene tree.


Default"Master"
Setterset_bus(value)
Getterget_bus()

Bus on which this audio is playing.


Default2000.0
Setterset_max_distance(value)
Getterget_max_distance()

Maximum distance from which audio is still hearable.


Default1.0
Setterset_pitch_scale(value)
Getterget_pitch_scale()

Changes the pitch and the tempo of the audio.


Defaultfalse
Getteris_playing()

If true, audio is playing.


Setterset_stream(value)
Getterget_stream()

The AudioStream object to be played.


Defaultfalse
Setterset_stream_paused(value)
Getterget_stream_paused()

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


Default0.0
Setterset_volume_db(value)
Getterget_volume_db()

Base volume without dampening.

Method Descriptions

  • float get_playback_position ( )

Returns the position in the AudioStream.


Returns the AudioStreamPlayback object associated with this AudioStreamPlayer2D.


  • void play ( float from_position=0.0 )

Plays the audio from the given position from_position, in seconds.


  • void seek ( float to_position )

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


  • void stop ( )

Stops the audio.

Doc ID missing

Disclaimer: This page has been automaticaly and directly extracted from the official Godot Docs website, the 1970-01-01 at 00:00:00. It’s the English Stable version because it’s what most Godot users should use. The Copyright owners are Juan Linietsky, Ariel Manzur and the Godot community. CC-BY 3.0. Thanks for your patience and generosity.