Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

AudioStreamPlayer3D

Inherits: Node3D < Node < Object

Plays positional sound in 3D space.

Description

Plays audio with positional sound effects, based on the relative position of the audio listener. Positional effects include distance attenuation, directionality, and the Doppler effect. For greater realism, a low-pass filter is applied to distant sounds. This can be disabled by setting attenuation_filter_cutoff_hz to 20500.

By default, audio is heard from the camera position. This can be changed by adding an AudioListener3D node to the scene and enabling it by calling AudioListener3D.make_current on it.

See also AudioStreamPlayer to play a sound non-positionally.

Note: Hiding an AudioStreamPlayer3D node does not disable its audio output. To temporarily disable an AudioStreamPlayer3D's audio output, set volume_db to a very low value like -100 (which isn't audible to human hearing).

Tutorials

Properties

int

area_mask

1

float

attenuation_filter_cutoff_hz

5000.0

float

attenuation_filter_db

-24.0

AttenuationModel

attenuation_model

0

bool

autoplay

false

StringName

bus

&"Master"

DopplerTracking

doppler_tracking

0

float

emission_angle_degrees

45.0

bool

emission_angle_enabled

false

float

emission_angle_filter_attenuation_db

-12.0

float

max_db

3.0

float

max_distance

0.0

int

max_polyphony

1

float

panning_strength

1.0

float

pitch_scale

1.0

bool

playing

false

AudioStream

stream

bool

stream_paused

false

float

unit_size

10.0

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 AttenuationModel:

AttenuationModel ATTENUATION_INVERSE_DISTANCE = 0

Attenuation of loudness according to linear distance.