FMOD inconsistent bank loading in WebGL (Uncaught TypeError)

Hey everyone!

I’ve been having an issue with a game we created for a game jam, and posted on our page. I’m using FMOD 2.02.15 and Unity 2022.3.7f1.

Here’s the game link: https:// alimen6. itch. io/ mutablob
(Broken up link because of new user restrictions)

The banks sometimes load successfully, and other times, they don’t. Some people can reload the game multiple times and get the audio, while some others (like me) can sometimes get the game to load the banks successfully the first time, but fail on subsequent reloads.

In the posted version of the game, my Source Type is Single Platform Build, pointing to one folder higher than the “Desktop” folder (having a similar to the issue described here Help! Banks not loading. I think i messed up my FMOD settings - #19 by fscolter1, but have worked around it). I’m loading the banks by setting the Initialization > Load Banks > All. Then, I have a loading script in a loading scene, that has Start set as a coroutine, and waits while the FMODUnity.RuntimeManager.HaveAllBanksLoaded property is false. After they have loaded, it shows a button that the player can click to fulfill the required user interaction before the game will play any audio in WebGL.

This version works sometimes, and some people get audio. Others don’t. I have tried fixing in multiple ways, but I get the same inconsistent audio. I’ve tried changing the compression settings in Unity to Disabled, moving my banks to StreamingAssets, modifying my script to use the asynchronous loading example in the documentation, waiting a couple of seconds before starting, making the buffer size larger… I don’t know exactly what’s causing it but it’s driving me crazy!

In the development console for the browser, when the audio doesn’t load, the only error I can see is this one:

Uncaught TypeError: Cannot read properties of undefined (reading ‘length’)
at AudioProcessor.process (5160c3be-a907-4b8a-b2e4-95ec3138053a:1:688)

The error points to the following line, where “length” is the issue (I realize this snippet on its own isn’t too helpful but I can provide the whole script if needed):

const bufferSliceEnd = this.bufferSize / output[0].length;

I have successfully built WebGL games with FMOD sound before, and I cannot figure out exactly what the problem is here. I can provide more extensive files if needed. Please help!

Guys, it seems I have fixed the issue.

In my case, the “output mode” setting under “WebGL” platform specific settings needed to be set to JavaScript webaudio output.
I had set it up that way in my previous projects, but failed to notice it when copying the settings!