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

Static variables

@:native("BusCount")staticBUS_COUNT:Int

Number of available audio buses.

@:native("Device")staticDEVICE:String

Name of the current device for audio output (see godot.AudioServer.getDeviceList). 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".

@:native("GlobalRateScale")staticGLOBAL_RATE_SCALE:Single

Scales the rate at which audio is played (i.e. setting it to 0.5 will make the audio be played twice as fast).

@:native("Singleton")staticread onlySINGLETON:Object

staticread onlyonBusLayoutChanged:Signal<() ‑> Void>

bus_layout_changed signal.

Static methods

@:native("AddBus")staticaddBus(?atPosition:Int):Void

Adds a bus at at_position.

@:native("AddBusEffect")staticaddBusEffect(busIdx:Int, effect:AudioEffect, ?atPosition:Int):Void

Adds an godot.AudioEffect effect to the bus bus_idx at at_position.

@:native("CaptureGetDevice")staticcaptureGetDevice():String

Name of the current device for audio input (see godot.AudioServer.captureGetDeviceList). The value "Default" means that the system-wide default audio input is currently used.

@:native("CaptureGetDeviceList")staticcaptureGetDeviceList():Array

Returns the names of all audio input devices detected on the system.

@:native("CaptureSetDevice")staticcaptureSetDevice(name:String):Void

Sets which audio input device is used for audio capture. On systems with multiple audio inputs (such as analog and USB), this can be used to select the audio input device. Setting the value "Default" will record audio from the system-wide default audio input. If an invalid device name is set, the value will be reverted back to "Default".

@:native("GenerateBusLayout")staticgenerateBusLayout():AudioBusLayout

Generates an godot.AudioBusLayout using the available buses and effects.

@:native("GetBusChannels")staticgetBusChannels(busIdx:Int):Int

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

@:native("GetBusCount")staticgetBusCount():Int

@:native("GetBusEffect")staticgetBusEffect(busIdx:Int, effectIdx:Int):AudioEffect

Returns the godot.AudioEffect at position effect_idx in bus bus_idx.

@:native("GetBusEffectCount")staticgetBusEffectCount(busIdx:Int):Int

Returns the number of effects on the bus at bus_idx.

@:native("GetBusEffectInstance")staticgetBusEffectInstance(busIdx:Int, effectIdx:Int, ?channel:Int):AudioEffectInstance

Returns the godot.AudioEffectInstance assigned to the given bus and effect indices (and optionally channel).

@:native("GetBusIndex")staticgetBusIndex(busName:String):Int

Returns the index of the bus with the name bus_name.

@:native("GetBusName")staticgetBusName(busIdx:Int):String

Returns the name of the bus with the index bus_idx.

@:native("GetBusPeakVolumeLeftDb")staticgetBusPeakVolumeLeftDb(busIdx:Int, channel:Int):Single

Returns the peak volume of the left speaker at bus index bus_idx and channel index channel.

@:native("GetBusPeakVolumeRightDb")staticgetBusPeakVolumeRightDb(busIdx:Int, channel:Int):Single

Returns the peak volume of the right speaker at bus index bus_idx and channel index channel.

@:native("GetBusSend")staticgetBusSend(busIdx:Int):String

Returns the name of the bus that the bus at index bus_idx sends to.

@:native("GetBusVolumeDb")staticgetBusVolumeDb(busIdx:Int):Single

Returns the volume of the bus at index bus_idx in dB.

@:native("GetDevice")staticgetDevice():String

@:native("GetDeviceList")staticgetDeviceList():Array

Returns the names of all audio devices detected on the system.

@:native("GetGlobalRateScale")staticgetGlobalRateScale():Single

@:native("GetMixRate")staticgetMixRate():Single

Returns the sample rate at the output of the godot.AudioServer.

@:native("GetOutputLatency")staticgetOutputLatency():Float

Returns the audio driver's output latency.

@:native("GetSpeakerMode")staticgetSpeakerMode():AudioServer_SpeakerMode

Returns the speaker configuration.

@:native("GetTimeSinceLastMix")staticgetTimeSinceLastMix():Float

Returns the relative time since the last mix occurred.

@:native("GetTimeToNextMix")staticgetTimeToNextMix():Float

Returns the relative time until the next mix occurs.

@:native("IsBusBypassingEffects")staticisBusBypassingEffects(busIdx:Int):Bool

If true, the bus at index bus_idx is bypassing effects.

@:native("IsBusEffectEnabled")staticisBusEffectEnabled(busIdx:Int, effectIdx:Int):Bool

If true, the effect at index effect_idx on the bus at index bus_idx is enabled.

@:native("IsBusMute")staticisBusMute(busIdx:Int):Bool

If true, the bus at index bus_idx is muted.

@:native("IsBusSolo")staticisBusSolo(busIdx:Int):Bool

If true, the bus at index bus_idx is in solo mode.

@:native("Lock")staticlock():Void

Locks the audio driver's main loop.

Note: Remember to unlock it afterwards.

@:native("MoveBus")staticmoveBus(index:Int, toIndex:Int):Void

Moves the bus from index index to index to_index.

@:native("RemoveBus")staticremoveBus(index:Int):Void

Removes the bus at index index.

@:native("RemoveBusEffect")staticremoveBusEffect(busIdx:Int, effectIdx:Int):Void

Removes the effect at index effect_idx from the bus at index bus_idx.

@:native("SetBusBypassEffects")staticsetBusBypassEffects(busIdx:Int, enable:Bool):Void

If true, the bus at index bus_idx is bypassing effects.

@:native("SetBusCount")staticsetBusCount(amount:Int):Void

@:native("SetBusEffectEnabled")staticsetBusEffectEnabled(busIdx:Int, effectIdx:Int, enabled:Bool):Void

If true, the effect at index effect_idx on the bus at index bus_idx is enabled.

@:native("SetBusLayout")staticsetBusLayout(busLayout:AudioBusLayout):Void

Overwrites the currently used godot.AudioBusLayout.

@:native("SetBusMute")staticsetBusMute(busIdx:Int, enable:Bool):Void

If true, the bus at index bus_idx is muted.

@:native("SetBusName")staticsetBusName(busIdx:Int, name:String):Void

Sets the name of the bus at index bus_idx to name.

@:native("SetBusSend")staticsetBusSend(busIdx:Int, send:String):Void

Connects the output of the bus at bus_idx to the bus named send.

@:native("SetBusSolo")staticsetBusSolo(busIdx:Int, enable:Bool):Void

If true, the bus at index bus_idx is in solo mode.

@:native("SetBusVolumeDb")staticsetBusVolumeDb(busIdx:Int, volumeDb:Single):Void

Sets the volume of the bus at index bus_idx to volume_db.

@:native("SetDevice")staticsetDevice(device:String):Void

@:native("SetGlobalRateScale")staticsetGlobalRateScale(scale:Single):Void

@:native("SwapBusEffects")staticswapBusEffects(busIdx:Int, effectIdx:Int, byEffectIdx:Int):Void

Swaps the position of two effects in bus bus_idx.

@:native("Unlock")staticunlock():Void

Unlocks the audio driver's main loop. (After locking it, you should always unlock it.)