I have a project that I wanted to start working on again but the sounds in the place are now broken, and making terrible sputtering noises when playing at the same time. I do not know when the bug started happening, but I notice it now.
I had last updated the place a 6 months ago and do not recall this bug happening.
I have sounds in a place along a small river that would play water sounds. If more than one sound is playing at a time, then they all sound like sputtery garbage.
This bug happens every time. Tested multiple times in studio and StartServer-StartPlayer.
Attached is a repro place file with two sounds inside parts. When you play the place, and toggle the “Playing” property of both sounds, the noise become garbage.
this has been reported many times over the past several months
I think they acknowledged it was a problem a few months ago but I don’t believe there has been any word on a fix
it is extremely annoying in sound heavy games
Hi Reshiram110, do you have an .rbxl file that demonstrates the problem with TimePosition? Or can you give a detailed recipe that reliably reproduces it? I’m looking into fixing it, but have not been able to reproduce it yet.
Here’s an explanation of the modules and localscript: game.ReplicatedFirst.Audio : This localscript contains a snippet from my loading screen code. This is part of the code in question that is affected by the bug.
game.ReplicatedStorage.Utils.AssetUtils : Just a util module that makes it easier to preload assets by reducing the amount of code that I need to type when I need to preload an asset.
game.ReplicatedStorage.Classes.AudioPlayer : The audio player class with the code that (potentially?) causes the bug.
I’ve noticed that the bug never occurs when the localscript is ran anywhere else other than game.ReplicatedFirst. The bug ONLY occurs in game.ReplicatedFirst.
STEPS TO REPRODUCE BUG:
Just re-run play solo (or just keep rejoining a local server if you want) until the audio in the game doesn’t start from the beginning. Note how the time position shows as being at the correct time, but the audio itself is not at the correct time. Now, move the Audio localscript from ReplicatedFirst to StarterPlayerScripts. Notice how the bug never occurs when trying to reproduce it?
Reshiram110, I have not been able to reproduce the problem yet even with your .rbxl file.
I tried both “Test/Play” and “Test/Start” in Studio multiple times. In order to get the game to run properly with “Test/Start” I had to add the line
local utils = game.ReplicatedStorage:waitForChild(“Utils”)
to the beginning of the Audio script.
I suspect that whatever is happening is related in a delicate way to load timing and I am seeing different timing at my network location.
I need to confirm, but what I think is happening is this: the sound is played without checking to see if it is loaded yet. Before the sound is loaded, the length of the sound is unknown, so TimeLength is 0. If the sound is played before the load completes, then it will either finish playing or will loop immediately. Once it loops, the TimePosition is reset to 0 from whatever you set it to, and it stays there while looping. Then when the sound finishes loading playback will continue from TimePosition 0 instead of where it was supposed to. Since the amount of time it takes to load the sound varies, sometimes the sound will load fast and playback will be correct and sometimes the sound will load too slowly, playback starts too early, and the playback is wrong. A workaround is to wait and confirm that the sound is loaded before starting playback. Running from a real server, I consistently get wrong playback with the script as it is, but consistently get right playback if I insert a 1 second wait after setting the SoundId. 1s is of course overkill, the right thing to do would be a loop checking isLoaded with a small wait, or do something using the Loaded event
Despite the fact, 3 years later, this issue still occurs, so clearly not fixed.
Although this isn’t a common issue now, it has just happened to me after merely touching the Max and min rolloff distances, and nothing I do, including changing those rolloffs back to their original or new values and adding a wait and :play() into the script (sounds are already playing), will fix it.
This happened today, I was scripting a basic script to modify sounds that loops in a while loop to change the pitch based on a changing value (in this case, the velocity magnitude).
No other sounds have broken, except these two specific sounds. I have other instances of these sound ids and those work fine, they both have the same grandparent (parent of a parent) which is a model. Why is this happening? Sometimes the sonuds splutter, sometimes they just never play. Its a bit random and its super frustrating.