Up to date

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

AudioServer

Inherits: Object

Server interface for low-level audio access.

Description

AudioServer is a low-level server interface for audio access. It is in charge of creating sample data (playable audio) as well as its playback via a voice interface.

Tutorials

Properties

int

bus_count

1

String

input_device

"Default"

String

output_device

"Default"

float

playback_speed_scale

1.0

Methods

void

add_bus ( int at_position=-1 )

void

add_bus_effect ( int bus_idx, AudioEffect effect, int at_position=-1 )

AudioBusLayout

generate_bus_layout ( ) const

int

get_bus_channels ( int bus_idx ) const

AudioEffect

get_bus_effect ( int bus_idx, int effect_idx )

int

get_bus_effect_count ( int bus_idx )

AudioEffectInstance

get_bus_effect_instance ( int bus_idx, int effect_idx, int channel=0 )

int

get_bus_index ( StringName bus_name ) const

String

get_bus_name ( int bus_idx ) const

float

get_bus_peak_volume_left_db ( int bus_idx, int channel ) const

float

get_bus_peak_volume_right_db ( int bus_idx, int channel ) const

StringName

get_bus_send ( int bus_idx ) const

float

get_bus_volume_db ( int bus_idx ) const

PackedStringArray

get_input_device_list ( )

float

get_mix_rate ( ) const

PackedStringArray

get_output_device_list ( )

float

get_output_latency ( ) const

SpeakerMode

get_speaker_mode ( ) const

float

get_time_since_last_mix ( ) const

float

get_time_to_next_mix ( ) const

bool

is_bus_bypassing_effects ( int bus_idx ) const

bool

is_bus_effect_enabled ( int bus_idx, int effect_idx ) const

bool

is_bus_mute ( int bus_idx ) const

bool

is_bus_solo ( int bus_idx ) const

void

lock ( )

void

move_bus ( int index, int to_index )

void

remove_bus ( int index )

void

remove_bus_effect ( int bus_idx, int effect_idx )

void

set_bus_bypass_effects ( int bus_idx, bool enable )

void

set_bus_effect_enabled ( int bus_idx, int effect_idx, bool enabled )

void

set_bus_layout ( AudioBusLayout bus_layout )

void

set_bus_mute ( int bus_idx, bool enable )

void

set_bus_name ( int bus_idx, String name )

void

set_bus_send ( int bus_idx, StringName send )

void

set_bus_solo ( int bus_idx, bool enable )

void

set_bus_volume_db ( int bus_idx, float volume_db )

void

set_enable_tagging_used_audio_streams ( bool enable )

void

swap_bus_effects ( int bus_idx, int effect_idx, int by_effect_idx )

void

unlock ( )


Signals

bus_layout_changed ( )

Emitted when an audio bus is added, deleted, or moved.


bus_renamed ( int bus_index, StringName old_name, StringName new_name )

Emitted when the audio bus at bus_index is renamed from old_name to new_name.


Enumerations

enum SpeakerMode:

SpeakerMode SPEAKER_MODE_STEREO = 0

Two or fewer speakers were detected.

SpeakerMode SPEAKER_SURROUND_31 = 1

A 3.1 channel surround setup was detected.

SpeakerMode SPEAKER_SURROUND_51 = 2

A 5.1 channel surround setup was detected.

SpeakerMode SPEAKER_SURROUND_71 = 3

A 7.1 channel surround setup was detected.


Property Descriptions

int bus_count = 1

  • void set_bus_count ( int value )

  • int get_bus_count ( )

Number of available audio buses.


String input_device = "Default"

  • void set_input_device ( String value )

  • String get_input_device ( )

Name of the current device for audio input (see get_input_device_list). On systems with multiple audio inputs (such as analog, USB and HDMI audio), this can be used to select the audio input device. The value "Default" will record audio on the system-wide default audio input. If an invalid device name is set, the value will be reverted back to "Default".

Note: ProjectSettings.audio/driver/enable_input must be true for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings.


String output_device = "Default"

  • void set_output_device ( String value )

  • String get_output_device ( )

Name of the current device for audio output (see get_output_device_list). On systems with multiple audio outputs (such as analog, USB and HDMI audio), this can be used to select the audio output device. The value "Default" will play audio on the system-wide default audio output. If an invalid device name is set, the value will be reverted back to "Default".


float playback_speed_scale = 1.0

  • void set_playback_speed_scale ( float value )

  • float get_playback_speed_scale ( )

Scales the rate at which audio is played (i.e. setting it to 0.5 will make the audio be played at half its speed).


Method Descriptions

void add_bus ( int at_position=-1 )

Adds a bus at at_position.


void add_bus_effect ( int bus_idx, AudioEffect effect, int at_position=-1 )

Adds an AudioEffect effect to the bus bus_idx at at_position.


AudioBusLayout generate_bus_layout ( ) const

Generates an AudioBusLayout using the available buses and effects.


int get_bus_channels ( int bus_idx ) const

Returns the number of channels of the bus at index bus_idx.


AudioEffect get_bus_effect ( int bus_idx, int effect_idx )

Returns the AudioEffect at position effect_idx in bus