When creating my roblox game, I noticed that sounds have a noticeable latency compared to the actual audio file when played, Im not sure what’s causing this. I’ve tried debugging it and even made a new place just to test this behavior.
I uploaded a gunshot sound and imported it into roblox studio. When i call Sound:Play(), I print a statement at the same time so i know exactly when the sound is triggered, I then tried matching that print timing with the original local audio file in an editing app, and i found that there is a delay. since im working on a game similar to FNF’, this delay really matters.
As you can see in the image, the blue track is the recorded video (.mp4) captured using NVIDIA recorder, and the green track is the original gunshot audio file (.mp3), I aligned the marker (red line) with the start of the print statement, and there’s a delay of around 7-8 frames before the sound actually plays for some reason.
My issue was that I was cloning a sound instance and then playing the cloned instance. Not cloning the instance and playing the original one fixed it for me, let me know if this helps
If you’re cloning the sound before playing it, a possible solution is to not destroy the cloned sound immediately after playing. Destroying sounds too quickly after playing them (even if playback finished!) can cause playback issues for some reason.
Example:
local clone = sound:Clone()
clone:Play()
task.wait(sound.TimeLength + 5) -- fixed extra time is better than a factor
clone:Destroy()
i’ve cloned the instance and then played in sound service, i’ve tried using the roblox play and testing the latency, for me it was ~4 frames, for my first friend its ~3 frames, my second friend its ~2 frames, i’ve tried it on my ipad and my iphone and they were instant.