AudioStreamPlayer3D

Inherits: Spatial < Node < Object

Plays positional sound in 3D space.

Descripción

Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space. For greater realism, a low-pass filter is automatically 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 a Listener node to the scene and enabling it by calling Listener.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 unit_db to a very low value like -100 (which isn't audible to human hearing).

Tutoriales

Propiedades

int

area_mask

1

float

attenuation_filter_cutoff_hz

5000.0

float

attenuation_filter_db

-24.0

AttenuationModel

attenuation_model

0

bool

autoplay

false

String

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

OutOfRangeMode

out_of_range_mode

0

float

pitch_scale

1.0

bool

playing

false

AudioStream

stream

bool

stream_paused

false

float

unit_db

0.0

float

unit_size

1.0

Métodos

float

get_playback_position ( )

AudioStreamPlayback

get_stream_playback ( )

void

play ( float from_position=0.0 )

void

seek ( float to_position )

void

stop ( )

Señales

  • finished ( )

Emitido cuando el audio deja de reproducirse.

Enumeraciones

enum AttenuationModel:

  • ATTENUATION_INVERSE_DISTANCE = 0 --- Amortiguación lineal de la sonido según la distancia.

  • ATTENUATION_INVERSE_SQUARE_DISTANCE = 1 --- Amortiguación cuadrada del sonido según la distancia.

  • ATTENUATION_LOGARITHMIC = 2 --- Amortiguación logarítmica del sonido según la distancia.

  • ATTENUATION_DISABLED = 3 --- No dampening of loudness according to distance. The sound will still be heard positionally, unlike an AudioStreamPlayer. ATTENUATION_DISABLED can be combined with a max_distance value greater than 0.0 to achieve linear attenuation clamped to a sphere of a defined size.


enum OutOfRangeMode:

  • OUT_OF_RANGE_MIX = 0 --- Mix this audio in, even when it's out of range. This increases CPU usage, but keeps the sound playing at the correct position if the camera leaves and enters the AudioStreamPlayer3D's max_distance radius.

  • OUT_OF_RANGE_PAUSE = 1 --- Pause this audio when it gets out of range. This decreases CPU usage, but will cause the sound to restart if the camera leaves and enters the AudioStreamPlayer3D's max_distance radius.


enum DopplerTracking:

  • DOPPLER_TRACKING_DISABLED = 0 --- Desactiva el rastreo doppler.

  • DOPPLER_TRACKING_IDLE_STEP = 1 --- Executes doppler tracking in idle step (every rendered frame).

  • DOPPLER_TRACKING_PHYSICS_STEP = 2 --- Executes doppler tracking in physics step (every simulated physics frame).

Descripciones de Propiedades

  • int area_mask

Default

1

Setter

set_area_mask(value)

Getter

get_area_mask()

Áreas en las que se reproduce este sonido.


  • float attenuation_filter_cutoff_hz

Default

5000.0

Setter

set_attenuation_filter_cutoff_hz(value)

Getter

get_attenuation_filter_cutoff_hz()

Dampens audio using a low-pass filter above this frequency, in Hz. To disable the dampening effect entirely, set this to 20500 as this frequency is above the human hearing limit.


  • float attenuation_filter_db

Default

-24.0

Setter

set_attenuation_filter_db(value)

Getter

get_attenuation_filter_db()

Amount how much the filter affects the loudness, in decibels.


Default

0

Setter

set_attenuation_model(value)

Getter

get_attenuation_model()

Decide si el audio debe ser más silencioso con la distancia lineal, cuadrática, logarítmica, o no ser afectado por la distancia, desactivando efectivamente la atenuación.


Default

false

Setter

set_autoplay(value)

Getter

is_autoplay_enabled()

If true, audio plays when the AudioStreamPlayer3D node is added to scene tree.


Default

"Master"

Setter

set_bus(value)

Getter

get_bus()

The bus on which this audio is playing.


Default

0

Setter

set_doppler_tracking(value)

Getter

get_doppler_tracking()

Decides in which step the Doppler effect should be calculated.

Note: Only effective if the current Camera's Camera.doppler_tracking property is set to a value other than Camera.DOPPLER_TRACKING_DISABLED.


  • float emission_angle_degrees

Default

45.0

Setter

set_emission_angle(value)

Getter

get_emission_angle()

El ángulo en el que el audio llega a las cámaras sin amortiguar.


  • bool emission_angle_enabled

Default

false

Setter

set_emission_angle_enabled(value)

Getter

is_emission_angle_enabled()

Si true, el audio debe ser amortiguado de acuerdo a la dirección del sonido.


  • float emission_angle_filter_attenuation_db

Default

-12.0

Setter

set_emission_angle_filter_attenuation_db(value)

Getter

get_emission_angle_filter_attenuation_db()

Dampens audio if camera is outside of emission_angle_degrees and emission_angle_enabled is set by this factor, in decibels.


Default

3.0

Setter

set_max_db(value)

Getter

get_max_db()

Sets the absolute maximum of the soundlevel, in decibels.


Default

0.0

Setter

set_max_distance(value)

Getter

get_max_distance()

Establece la distancia a partir de la cual el out_of_range_mode tiene efecto. No tiene efecto si se pone a 0.


Default

0

Setter

set_out_of_range_mode(value)

Getter

get_out_of_range_mode()

Decide si el audio debe hacer una pausa cuando la fuente está fuera del rango de max_distance.


Default

1.0

Setter

set_pitch_scale(value)

Getter

get_pitch_scale()

El tono y el tempo del audio, como multiplicador de la tasa de muestreo de la muestra de audio.


Default

false

Getter

is_playing()

Si true, el audio se está reproduciendo.


Setter

set_stream(value)

Getter

get_stream()

The AudioStream resource to be played.


  • bool 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.


Default

0.0

Setter

set_unit_db(value)

Getter

get_unit_db()

The base sound level unaffected by dampening, in decibels.


Default

1.0

Setter

set_unit_size(value)

Getter

get_unit_size()

The factor for the attenuation effect. Higher values make the sound audible over a larger distance.

Descripciones de Métodos

  • float get_playback_position ( )

Devuelve la posición en el AudioStream.


Devuelve el objeto AudioStreamPlayback asociado a este AudioStreamPlayer3D.


  • void play ( float from_position=0.0 )

Reproduce el audio desde la posición dada de_posición, en segundos.


  • void seek ( float to_position )

Establece la posición desde la que se reproducirá el audio, en segundos.


  • void stop ( )

Detiene el audio.