This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

I made a very simple project with a base node and child SamplePlayer node. I added a sample to the sample library and wrote the code below:

extends Node2D

func _ready():

func _input(event):
    if event.type == InputEvent.MOUSE_BUTTON \
    and event.button_index == BUTTON_LEFT \
    and event.pressed:

My hope was that there would be no delay between clicking the mouse and hearing the sample. However, there is about 0.1 seconds of delay between the mouse click and the sample being heard. Is there a way to eliminate this delay, or reduce it so it is not noticeable?

in Engine by (156 points)

I'm VERY new to all of this but I've seen mention of pre loading scenes and resources in other threads. Is there some way you can perhaps pre load the sample which may speed up the reaction time?

AFAIK the audio engine will be rewritten in 3.0

1 Answer

+2 votes
Best answer

There is a way. SamplePlayer is probably your best choice for playing sounds in the shooting game that does not require a time critical audio reactions.
However if you need a relatively low audio latency experience you should use AudioServer, that provides low level audio access.
For me it works well in music related games/apps, giving less latency, quite good performance and better audio playback control.

by (722 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.