Sounds causing lag spikes

It seems that creating sounds and setting some of their properties is causing massive lag spikes of 25ms and above (even with a very high spec pc) in my game:

I tried making a repro place for this, but it seems to be somewhat random and doesn’t happen for me in a blank place. The lag spikes might occur every ~5s while footsteps happen about 2 times per second, for example.

The first lag spike here is from creating a sound in a part and setting its TimePosition for a voiceover. The second one is also from a sound inside a part, the sound plays during the footstep part of an animation.

Here’s a link to the place where it happens: ALONE: Early Access - Roblox

6 Likes

Same problem, I tried speaking with @spotco but couldn’t provide him with enough information.
I fixed the lag spikes by playing those sounds in PlayerGui at 0 volume, so creating new sounds causes 0 lag spikes.

Same here

solution to performance issue:
http://devforum.roblox.com/t/fps-be-gone-the-bug/40398/8?u=spotco

Ah is it possible to show your solution again? This issue has recently propped back up for me. In my case I’m changing only the volume and playback speeds of about 30 or so engine sounds, however those don’t happen at the same time but after one another so at any time its really only 5-8 sounds playing at once at the worst. All sounds are less than 5 seconds and are looped. Microprofiler showing as above’s two posts that Sound and Run Job are eating performance which Is impossible for me to understand as the Volume and Playback changes are made only once every change not multiple times per change that would cause lag.

To further show the issue i’m having at this place:

In this video of studio microprofiler testing: Microprofiler Analysis Of Sound In Studio - YouTube

The Video above shows studio microprofiler testing, I used the play mode as its assume to replicate to some degree the server on roblox player to a degree. As can be seen and heard the sounds of the train are without stutter or bugging and the profiler replicates this as should be.

Now in this video of Roblox Player microprofiler testing: Microprofiler Analysis Of Sound In Player - YouTube

The Above is completely different to Studio. Not only is the audio garbled and distorted with weird pops, its also dropping fps/lag spikes. Profiler is going nuts with a sound ms of 5x what it is in Studio. What is more confusing is the profiler shows the audio still takes up quite abit of ms when there sounds aren’t even running due to 0 volume and playbackspeed as compared to Studio which replicates what should really happen.

If its a limitation by the Server when on Player then is this intended or accidental? It be pretty hard to make immersive vehicle sounds if we can’t replicate what we hear in studio to player.

I’ve ruled out completely the Audio handler module as all it does is manipulate the volume and playbackspeed settings once every new significant change in this case speed change, if the speed hasn’t changed it doesn’t call playbackspeed or volume at all till that happens to prevent spam lag.

The audio module itself barely hits 0.1% ms so no clue where this sound bug comes from. @Khanovich not sure what staff member this will be referred to. Thanks

Unfortunately, Roblox can’t do anything about this. When a sound is played, it has to be relayed from either the server or the client, and depending on other sounds running, the volume, the quality (etc) that can affect your PC and cause lag.

Please leave a like and mark this as a solution if this post helped.

Understood but my issue is that it seems to be a massive difference between studio and player replication, im assuming then the play mode of studio is local side but ultimately as well the fact that it seems one cannot play at least 3-5 sounds at the same time which isn’t that a bit too restrictive if its the issue?

It depends on the clients PC, low end pcs won’t be able to take that much sound.

I’m running a very good build with a Ryzen 9 5900x and a RTX 2070 with 64GB ram and 1gb download speeds. Its glitching out completely with Player but is fine with studio, same result with a core 2 duo and 8gb ram test pc which plays normally in studio but glitches in Roblox Player. It seems to me like a bug but not 100% sure, as I can’t really believe for now at least its a performance issue when only 3-5 at any one time are playing and when the train is stationary and thus no audio playing it still lags on microprofiler and fps. My only assumption is that a sound actually stops playing when playbackspeed is 0 rather than it being either it or volume being 0 to stop a sound.

This CAN happen to me, only in a different case.
With my building system, it will clone a sound, play it, and destroy it for anything it needs to.

My destroy sound constantly creates and then destroys, causing heavy lag if not handled.

Ok so after further testing I’ve found out the issue. Playback not being 0 means the sounds will always play regardless of Volume being 0 unless Sound:Stop() is requested. With a vehicle engine calling Stop() wouldn’t make sense but I’ve found my solution, it be nice as I can’t see it anywhere to state that sounds play irrespective of Volume level if PlaybackSpeed itself is above 0 so that for things that use more advanced levels of sound they can be optimized well.