Skip to main content

AudioStreamPlayer

Inherits: Node < Object

Description

A node for audio playback. The AudioStreamPlayer node plays an audio stream non-positionally. It is ideal for user interfaces, menus, or background music.

Properties

AudioStream
The AudioStream resource to be played.
float
default:"0.0"
Volume of sound, in decibels.
float
default:"1.0"
The audio’s pitch and tempo, as a multiplier of the stream’s sample rate.
bool
default:"false"
If true, this node is playing sounds.
bool
default:"false"
If true, this node calls play when entering the tree.
StringName
default:"Master"
The target bus name. All sounds from this node will be playing on this bus.

Methods

play

Plays a sound from the beginning, or the given position in seconds.
float
Position in seconds to start playback from (default: 0.0)

stop

Stops all sounds from this node.

seek

Restarts all sounds to be played from the given position, in seconds.

get_playback_position

Returns the position in the AudioStream of the latest sound, in seconds.

Signals

finished()

Emitted when a sound finishes playing without interruptions.

Example Usage