Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

AudioStreamPlayer

Inherits: Node < Object

Plays back audio non-positionally.

Description

Plays an audio stream non-positionally.

To play audio positionally, use AudioStreamPlayer2D or AudioStreamPlayer3D instead of AudioStreamPlayer.

Tutorials

Properties

bool

autoplay

false

StringName

bus

&"Master"

int

max_polyphony

1

MixTarget

mix_target

0

float

pitch_scale

1.0

bool

playing

false

AudioStream

stream

bool

stream_paused

false

float

volume_db

0.0

Methods

float

get_playback_position ( )

AudioStreamPlayback

get_stream_playback ( )

bool

has_stream_playback ( )

void

play ( float from_position=0.0 )

void

seek ( float to_position )

void

stop ( )


Signals

finished ( )

Emitted when the audio stops playing.


Enumerations

enum MixTarget:

MixTarget MIX_TARGET_STEREO = 0

The audio will be played only on the first channel.

MixTarget MIX_TARGET_SURROUND = 1

The audio will be played on all surround channels.

MixTarget MIX_TARGET_CENTER = 2

The audio will be played on the second channel, which is usually the center.


Property Descriptions

bool autoplay = false

  • void set_autoplay ( bool value )

  • bool is_autoplay_enabled ( )

If true, audio plays when added to scene tree.


StringName bus = &"Master"

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".


int max_polyphony = 1

  • void set_max_polyphony ( int value )

  • int get_max_polyphony ( )

The maximum number of sounds this node can play at the same time. Playing additional sounds after this value is reached will cut off the oldest sounds.


MixTarget mix_target = 0

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


float pitch_scale = 1.0

  • void set_pitch_scale ( float value )