Sounds are sputtery and broken


#1
  • 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.

Glitchy Sounds.rbxl (12.9 KB)


Same SoundId Jitters When Played Close Together
#2

This was happening in a game I’m working on too. I fixed it by wrapping :Play() in spawn(), but I’m not sure why that works and it makes a tiny delay before the sound starts playing.


#3

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


#4

Yes this has the same root issue as a few other sound reports. Latest attempt at fixing this issue (… without breaking other parts of sound playback :sweat_smile:) will be rolling out to desktops this week.


#5

The experiment last week was a partial failure (increase in crash rate), we are investigating another fix


#6

I also wanted to point out that .TimePosition isn’t working as expected.

My code sets the TimePosition of an audio to 20 seconds, then plays it.

Half the time it works, half the time it doesn’t work. When it doesn’t work, the audio will play from the beginning, but the TimePosition property reads as it being 20 seconds.


#7

I want to have 2 speakers playing music, but the distance in between them is a jittery mess >:(


#8

I don’t know if this is related, but sounds no longer overlap each other and they’re cut off if you have an automatic weapon, or any other object that plays a sound a lot in a single second.

A simple work around is to create a sound object when the event fires, but the problem with that is it might cause a performance hit due to sounds being created and then instantly destroyed.


#9

Duplicate of this bug report back in December


#10

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.


#11

Hi, here’s the repo file:
AudioPlayer_Bug_Repo.rbxl (17.3 KB)

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.

NOTE:
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?


#12

Thanks Reshiram110!


#13

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.


#14

O.k., I can reproduce it when running off of a real server. Thanks, A reproducible case is a huge help!


#15

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


#16

Thanks, I’ll implement this in my code and let you know if it works! :slight_smile: