[WebGL] Stuttering audio too problematic with FMOD

Unfortunately having integrated FMOD into a WebGL project for the last few months, we’re facing the hard decision to shift back to unity built in audio.

The primary driver for this is stuttering audio experienced in WebGL browser. Similar to some other users we have issues with scene loading boundaries, as well as occasional “during play” stutters. The during play stutters due to dropped frames are difficult to eliminate (an example of this is a large addressable which gets downloaded in the background and loaded into memory, spending ~60ms on lower end devices).

Some techniques help (e.g. ducking audio between loading) with a small impact on user experience, but during play, even the odd stutter or two is enough to negatively impact the sense of interaction in a way that is less noticeable with a visual frame drop. And eliminating all the individual causes of stutters is not a guarantee as we are also constrained by some of unity’s systems.

Is there anything on the FMOD configuration level that I can leverage to try to compensate? I tried playing with DSP buffer size, but still experience stutter, am I right in thinking the max acceptable latency at 2048 is effectively 40ms of a blocked frame?

Unfortunately I feel like moving away from FMOD to built in is the most likely scenario for us right now :frowning: I appreciate that FMOD is severely limited by browser capability.



1 Like

There are a few things you could try, but at the end of the day WebGL is a single-threaded environment with no access to the GPU and, as you mentioned, varying performance between browsers. Some things to try:

  • Never have more than one streaming asset playing at a time.
  • Preload banks/events before gameplay, and unload anything you don’t need.
  • Where possible, reduce the Max Instances count and use a relevant Voice Stealing option to compensate for dropouts.
  • Avoid convolution reverb.
  • Increase the DSP Buffer Length in the FMOD Unity settings for WebGL

40ms is the default for most platforms, with a DSP Buffer Length of 512 and DSP Buffer Count of 4. A DSP Buffer Length of 2048 and DSP Buffer Count of 4 would give you a 170ms of latency. Whether or not that is an acceptable amount of latency for your case is something to be determined with user testing.

1 Like

Hi, I would love to know how this worked out. We are debating using FMOD for a WebGL Unity project. Would love to talk to anyone at FMOD or author of this post for any insight. thank you Mike

Hey, we have been using FMOD with WebGL for almost a year now and we have been having a lot of problems with it, so I would really not recommend it.
Otherwise FMOD is amazing, but not for WebGL

Sorry to hear you’ve had a bad experience with FMOD in WebGL- what were the main problems you were having?

Same problem as the topic of this thread, audio stuttering.

I bumped buffer size up to 1024 and kept count at 4 using FMOD 2.02.11 and Unity 2017.3.16; that managed to get rid of stuttering for us :slight_smile:

weirdly having some playback trigger inconsistencies versus desktop but still investigating

edit: switched to 512 buffer and count of 2; got rid of stuttering but with acceptable latency. still having some playback trigger funkiness, though.

edit final: here’s the finished project, for global game jam! Dale The Snail: Roots of Revenge by Paul Barbato, The Chronomaniac, rcoppy, SweetFreak!, CM

1 Like

Some here:

  • Unity 2021.3.6f1
  • FMOD 20.02.12 (banks via AssetBundles)
  • Safari

After app start stuttering is enormous, it’s very uncomfortable for my ears.

But a good thing that after 30-40 sec this stuttering is gone.

I’m not sure that it’s fmod fault - fps is about 40 during that period, and after - 60.

Chrome doesn’t have such a problem.

As long as you are using Safari 15.2 or later all of the HTML5 optimizations should be available.
To use the SharedArrayBuffer optimization you will need to configure your server to use the “Cross-Origin-Opener-Policy: same-origin” and “Cross-Origin-Embedder-Policy: require-corp” policies, which should give you the best possible performance on HTML5.
General information about how to set these policies can be found here: Cross Origin Isolation
The specifics of how to set them will depend on how you are hosting your game.

1 Like

Are you asynchronously loading your banks? It sounds like maybe you’re loading everything in all at once, right at the start, which could be a big bottleneck. (You mentioned you’re using asset bundles, which unfortunately I don’t have much experience with.)

One thing I found is that I had to manually override the WebGL output mode to Javascript web audio output; auto didn’t work the same way / resulted in stuttering.

Here are the WebGL-specific settings for my last project:

If you do end up loading things asynchronously, you’ll need to mark Load banks to none under initialization:

If you want a really quick solution for loading banks manually, here’s one heavily based on the FMOD docs you should just be able to drop into a project: ggj-2023/FMODPreloader.cs at main · rcoppy/ggj-2023 · GitHub

Good luck! :slight_smile:


Yes. It is work!!
Today i look this topic and was already going to make hybrid audio system.
Thanks you save my time )