# Robotic sound on WebGL build, tips to avoid that?

**URL:** <https://qa.fmod.com/t/robotic-sound-on-webgl-build-tips-to-avoid-that/21086>\
**Category:** Unity\
**Created:** [January 11, 2024, 7:13pm UTC](https://qa.fmod.com/t/robotic-sound-on-webgl-build-tips-to-avoid-that/21086 "2024-01-11T19:13:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![canvasinkgames](https://avatars.discourse-cdn.com/v4/letter/c/9de0a6/32.png) [@canvasinkgames](https://qa.fmod.com/u/canvasinkgames)\
**Post date:** [January 11, 2024, 7:13pm UTC](https://qa.fmod.com/t/robotic-sound-on-webgl-build-tips-to-avoid-that/21086/1 "2024-01-11T19:13:55Z")

</div>

Hi! I am developing a Unity musical themed game called Music Rush and distributing to WebGL, check it out here: [Music Rush Totem by Canvas Games](https://canvas-games.itch.io/music-rush-totem)

We have been experiencing issues on the audio becoming Robotic when the device (browser or the computer) has low memory. We already changes to load and load every single song as a separate bank. What advices do you have for that?

We can try to:

1. Reduce the audio quality on build
2. Reduce the audio sample rate on build
3. Use import playback setting “Sream” on every song

I am out of ideas apart from these!

---

<div class="post-metadata">

**Author:** ![aishi1](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@aishi1](https://qa.fmod.com/u/aishi1)\
**Post date:** [January 12, 2024, 11:24am UTC](https://qa.fmod.com/t/robotic-sound-on-webgl-build-tips-to-avoid-that/21086/2 "2024-01-12T11:24:54Z")

</div>

Hello, I have a couple of ideas:

- Increasing the audio buffer
- Serving CORS headers where SharedArrayBuffer are available in-browser enables a fast path for mixing
- Maybe increasing the frequency of calls to update, by trial-and-error that fixed a lot of drop outs on my project, though I’m just making an audio player without a game engine.

Here’s the platform info in the docs: [https://www.fmod.com/docs/2.02/api/platforms-html5.html](https://www.fmod.com/docs/2.02/api/platforms-html5.html)

Hope that helps!

---

<div class="post-metadata">

**Author:** ![canvasinkgames](https://avatars.discourse-cdn.com/v4/letter/c/9de0a6/32.png) [@canvasinkgames](https://qa.fmod.com/u/canvasinkgames)\
**Post date:** [January 12, 2024, 8:06pm UTC](https://qa.fmod.com/t/robotic-sound-on-webgl-build-tips-to-avoid-that/21086/3 "2024-01-12T20:06:50Z")

</div>

Thanks for the tips!  
Changing the buffer dsp parameters indeed affects it directly. However, it is very hard to debug on which devices / browsers it is best set. Some runs well and other don’t, and it is very easy to reproduce when opening in a mobile browser. I know now that increasing the Buffer Lenght helps. If there is any tips on how to debug that, would be great.

About the othe suggestions, I haven’t tried yet. Is there any links you can suggest for us to understand what you mean?

---

<div class="post-metadata">

**Author:** ![aishi1](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@aishi1](https://qa.fmod.com/u/aishi1)\
**Post date:** [January 13, 2024, 12:55pm UTC](https://qa.fmod.com/t/robotic-sound-on-webgl-build-tips-to-avoid-that/21086/4 "2024-01-13T12:55:34Z")

</div>

Glad to hear adjusting the audio buffer helped!

I kind of know what you mean about debugging for different browsers. For some reason my project still pops a lot on Firefox, so I ended up narrowing to supporting Chrome and Safari. Kind of concerned about mobile, which I haven’t started testing yet…

The FMOD Html5-specific doc link I wrote above is a good place to start for getting AudioWorkletNode/SharedArrayBuffer optimization working (the Browser Compatibility section). You’d need to have control over the server though. To check if it’s working, if you make a build with the logging version of FMOD, it logs to the browser console if it’s using fast path mixing or not when the system initializes.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [January 18, 2024, 1:27am UTC](https://qa.fmod.com/t/robotic-sound-on-webgl-build-tips-to-avoid-that/21086/5 "2024-01-18T01:27:48Z")

</div>

Hi,

The suggestions @aishi1 has made are good, and the steps you’ve taken in reducing sample rate/quality and dynamically loading your banks are as well. Besides simply making your events less complex, and reducing the use of computationally expensive effects, our [HTML5 platform doc outlines some significant performance points](https://www.fmod.com/docs/2.02/api/platforms-html5.html#performance-and-memory).

Most notably in your case - “streaming” with HTML5 is often redundant as there is no disk to stream from, and the sample data that would normally be streamed is already loaded into memory anyway. As a result, in Studio I would recommend disabling streaming for assets on HTML5, which will cause the asset to use the default “compressed” loading mode instead and should be more performant. See the [Loading Modes section of the Studio manual](https://www.fmod.com/docs/2.02/studio/managing-assets.html#loading-modes) for more information.

Also, with the Debug Overlay enabled, or when using [`Studio::System::getCPUUsage`](https://www.fmod.com/docs/2.02/api/studio-api-system.html#studio_system_getcpuusage), what kind of numbers do you run into? If you haven’t already I would also recommend [enabling API error logging and setting your logging level to log in your FMOD for Unity settings](https://www.fmod.com/docs/2.02/unity/troubleshooting.html#logging) and seeing whether you run into any specific warnings/errors in a development build when you run into performance issues.
