# \[WebGL\] Stuttering audio too problematic with FMOD

**URL:** <https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834>\
**Category:** Unity\
**Created:** [June 2, 2022, 7:01pm UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834 "2022-06-02T19:01:06Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![mnewcombe](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mnewcombe/32/3178_2.png) [@mnewcombe](https://qa.fmod.com/u/mnewcombe)\
**Post date:** [June 2, 2022, 7:01pm UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/1 "2022-06-02T19:01:06Z")

</div>

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 ☹ I appreciate that FMOD is severely limited by browser capability.

Thanks,

Matt

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [June 6, 2022, 2:22am UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/2 "2022-06-06T02:22:49Z")

</div>

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](https://fmod.com/resources/documentation-studio?version=2.02&page=event-macro-controls-reference.html#max-instances) count and use a relevant [Voice Stealing](https://fmod.com/resources/documentation-studio?version=2.02&page=event-macro-controls-reference.html#stealing) option to compensate for dropouts.
- Avoid convolution reverb.
- Increase the _DSP Buffer Length_ in the FMOD Unity settings for WebGL

> [@mnewcombe](#):
>
> 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?

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.

---

<div class="post-metadata">

**Author:** ![mojo47](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@mojo47](https://qa.fmod.com/u/mojo47)\
**Post date:** [July 21, 2022, 10:45am UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/3 "2022-07-21T10:45:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AArtlone](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@AArtlone](https://qa.fmod.com/u/AArtlone)\
**Post date:** [January 18, 2023, 10:11am UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/4 "2023-01-18T10:11:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [January 19, 2023, 11:40pm UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/5 "2023-01-19T23:40:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AArtlone](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@AArtlone](https://qa.fmod.com/u/AArtlone)\
**Post date:** [January 27, 2023, 3:17pm UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/6 "2023-01-27T15:17:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arcoppi](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@arcoppi](https://qa.fmod.com/u/arcoppi)\
**Post date:** [February 3, 2023, 6:48pm UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/7 "2023-02-03T18:48:19Z")

</div>

> [@jeff\_fmod](#):
>
> Buffer

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 🙂

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](https://gigapully.itch.io/dalethesnail)

---

<div class="post-metadata">

**Author:** ![Maligan](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@Maligan](https://qa.fmod.com/u/Maligan)\
**Post date:** [February 4, 2023, 8:50am UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/8 "2023-02-04T08:50:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [February 9, 2023, 10:15pm UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/9 "2023-02-09T22:15:47Z")

</div>

As long as you are using Safari 15.2 or later all of the HTML5 [optimizations](https://fmod.com/docs/2.02/api/platforms-html5.html#browser-compatibility) should be available.  
To use the [SharedArrayBuffer](https://caniuse.com/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](https://web.dev/cross-origin-isolation-guide/#enable-cross-origin-isolation)  
The specifics of how to set them will depend on how you are hosting your game.

---

<div class="post-metadata">

**Author:** ![arcoppi](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@arcoppi](https://qa.fmod.com/u/arcoppi)\
**Post date:** [February 17, 2023, 1:58am UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/10 "2023-02-17T01:58:57Z")

</div>

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:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/7/7e90ff431596dc2ededd699144c934fd02b90805.png)

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

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/c/c7a4c38de5bed7bfa4e827789a7297bfc1008ef9.png)

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](https://github.com/rcoppy/ggj-2023/blob/main/ggj-unity-project/Assets/Scripts/Audio/FMODPreloader.cs)

Good luck! 🙂

---

<div class="post-metadata">

**Author:** ![Hafu](https://avatars.discourse-cdn.com/v4/letter/h/c2a13f/32.png) [@Hafu](https://qa.fmod.com/u/Hafu)\
**Post date:** [February 17, 2023, 4:41am UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/11 "2023-02-17T04:41:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![willozeas](https://avatars.discourse-cdn.com/v4/letter/w/8edcca/32.png) [@willozeas](https://qa.fmod.com/u/willozeas)\
**Post date:** [August 19, 2024, 6:43pm UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/12 "2024-08-19T18:43:46Z")

</div>

Setting output mode to JS web audio output worked for me!!! Thank you so much!

---

<div class="post-metadata">

**Author:** ![Kenken0615](https://avatars.discourse-cdn.com/v4/letter/k/e36b37/32.png) [@Kenken0615](https://qa.fmod.com/u/Kenken0615)\
**Post date:** [September 23, 2024, 1:01pm UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/13 "2024-09-23T13:01:40Z")

</div>

May i ask that how Fmod will know which platform i am in. Is it auto dected or not?  
For example, if i add webgl, android and ios.  
How does it ensure that WebGL is used when i am playing game on HTML5 platfrom?

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/2/26a9a478e01c1c31194252e41a4063c8e85bb967.png)

---

<div class="post-metadata">

**Author:** ![li\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/li_fmod/32/6577_2.png) [@li\_fmod](https://qa.fmod.com/u/li_fmod)\
**Post date:** [September 25, 2024, 3:58am UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/14 "2024-09-25T03:58:06Z")

</div>

Hi,

> [@Kenken0615](#):
>
> May i ask that how Fmod will know which platform i am in. Is it auto dected or not?

Yes, it is auto-detected.

> [@Kenken0615](#):
>
> How does it ensure that WebGL is used when i am playing game on HTML5 platfrom?

It is based on the build target set in Unity to determine which platform-specific libraries and settings to apply.

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXde41I98iC2hUQLw1TxJcozcBHkZXc2lsxuIbMzCNzdxcOF-o76U-E2E9tdgL0tUOQG_0wLgFg7FDIUO4KUJJeQJhyEffvsT-VFUTmxZqxlfG1kYA3R2l8sZHAL4redlWQ14bBQolTa47n6SrQkyPmYvzZC?key=LgOsq1BnsCSF97vsRQf-UQ)

Hope this helps. Let me know if you have any other questions.

---

<div class="post-metadata">

**Author:** ![Kenken0615](https://avatars.discourse-cdn.com/v4/letter/k/e36b37/32.png) [@Kenken0615](https://qa.fmod.com/u/Kenken0615)\
**Post date:** [September 25, 2024, 4:57am UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/15 "2024-09-25T04:57:47Z")

</div>

THank you so much!  
By the way, here.s another bug i faced:  
[FMOD] AAudio\_GetDriverInfoInternal : Could not get driver info for device with id: 1701669204.  
It is happend when fmod initialized…

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/b/b628a6595e86ffc13042f81fa478d8a57170eb00.jpeg)

Is it safe to be ingored?

---

<div class="post-metadata">

**Author:** ![li\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/li_fmod/32/6577_2.png) [@li\_fmod](https://qa.fmod.com/u/li_fmod)\
**Post date:** [September 29, 2024, 10:50pm UTC](https://qa.fmod.com/t/webgl-stuttering-audio-too-problematic-with-fmod/18834/16 "2024-09-29T22:50:47Z")

</div>

Thank you for sharing the info and log.

Could you please tick API Error logging and set the Logging Level to “Log” ([Unity Integration | 8. Settings | 8.2 Initialization | 8.2.1 Logging Level](https://fmod.com/docs/2.02/unity/settings.html#logging-level)) to see if you can get more error logs from the console?

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdj9BeCpxcahXE8JVPLqO6Wde3wpvD_tiJrpptv7sBGImFsErB4wK8H3Hm0CvM9L69CjVZ5Vd-pnNxsdY_AvLKakkwmcJ5etfSbrybNA4tc0lQhlKjtdP3A3exJqqjcJqATkwzMqMOhm2apWIvKNxSvTgFk?key=fsQWfGgbj_shEInlMLlerQ)

Would it be possible to elaborate more on the reproduction steps?
