AudioStreamPlayer3D

    Category: Core

    Plays 3D sound in 3D space.

    Properties

    Methods

    get_playback_position ( )
    get_stream_playback ( )
    void ( float from_position=0.0 )
    void ( float to_position )
    void ( )
    • finished ( )

    Fires when the audio stops playing.

    Enumerations

    enum AttenuationModel:

    • ATTENUATION_INVERSE_DISTANCE = 0 — Linear dampening of loudness according to distance.
    • ATTENUATION_INVERSE_SQUARE_DISTANCE = 1 — Squared dampening of loudness according to distance.
    • ATTENUATION_LOGARITHMIC = 2 — Logarithmic dampening of loudness according to distance.

    enum OutOfRangeMode:

    • OUT_OF_RANGE_PAUSE = 1 — Pause this audio when it gets out of range.

    enum DopplerTracking:

    • DOPPLER_TRACKING_DISABLED = 0 — Disables doppler tracking.
    • DOPPLER_TRACKING_IDLE_STEP = 1 — Executes doppler tracking in idle step.
    • DOPPLER_TRACKING_PHYSICS_STEP = 2 — Executes doppler tracking in physics step.

    Description

    Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space.

    Property Descriptions

    • area_mask
    Setterset_area_mask(value)
    Getterget_area_mask()

    Areas in which this sound plays.


    • float attenuation_filter_cutoff_hz
    Setterset_attenuation_filter_cutoff_hz(value)
    Getterget_attenuation_filter_cutoff_hz()

    Dampens audio above this frequency, in Hz.


    • attenuation_filter_db
    Setterset_attenuation_filter_db(value)
    Getterget_attenuation_filter_db()

    Setterset_attenuation_model(value)
    Getterget_attenuation_model()

    Decides if audio should get quieter with distance linearly, quadratically or logarithmically.


    • autoplay
    Setterset_autoplay(value)
    Getteris_autoplay_enabled()

    If , audio plays when added to scene tree. Default value: .


    Bus on which this audio is playing.


    • doppler_tracking
    Setterset_doppler_tracking(value)
    Getterget_doppler_tracking()

    Decides in which step the Doppler effect should be calculated.


    • float emission_angle_degrees
    Setterset_emission_angle(value)
    Getterget_emission_angle()

    The angle in which the audio reaches cameras undampened.


    Setterset_emission_angle_enabled(value)
    Getteris_emission_angle_enabled()

    If , the audio should be dampened according to the direction of the sound.


    • emission_angle_filter_attenuation_db
    Setterset_emission_angle_filter_attenuation_db(value)
    Getterget_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 dB.


    Setterset_max_db(value)
    Getterget_max_db()

    Sets the absolute maximum of the soundlevel, in dB.


    • max_distance
    Setterset_max_distance(value)
    Getterget_max_distance()

    Sets the distance from which the ‘out_of_range_mode’ takes effect. Has no effect if set to 0.



    • pitch_scale
    Setterset_pitch_scale(value)
    Getterget_pitch_scale()

    Changes the pitch and the tempo of the audio.


    Getteris_playing()

    If , audio is playing.


    • stream
    Setterset_stream(value)
    Getterget_stream()

    The AudioStream object to be played.


    • stream_paused
    Setterset_stream_paused(value)
    Getterget_stream_paused()

    Setterset_unit_db(value)
    Getterget_unit_db()

    Base sound level unaffected by dampening, in dB.


    • unit_size
    Setterset_unit_size(value)
    Getterget_unit_size()

    Factor for the attenuation effect.

    Method Descriptions

    • float get_playback_position ( )

    Returns the position in the .



    • void play ( from_position=0.0 )

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


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


    • void stop ( )

    Stops the audio.