Does WebGL support spatialized audio?

Hi guys,

Pretty simple question here. I’m working on a project for a client and the key technical components are that spatialised audio is utilised and that the project is able to be embedded into a website.

In the current Unity project (using Unity 2018.4.26f1 and FMOD Studio 2.00.10) I am able to get a functioning bounce into WebGL, but without any of the spatialised audio I have made in FMOD. The project is muted.

When I took off the spatialiser plugin and tried a build, I had the same outcome - no audio from FMOD.

The audio files I have within my event are 1st order ambisonic tracks that I have bounced from Reaper.

Is this why I’m not getting any audio? Because WebGL doesn’t support ambisonic audio files yet?

I have read about mentions of an API for a WebGL build with FMOD, but that has gone over my head a little bit on the technical front.

Any help would be greatly appreciated. If WebGL isn’t the solution, does anyone know of a way to embed a Unity project with spatialised audio into a website?

Cheers,

  • Tom

FMOD doesn’t natively support Ambisonics, support is derived by using the Resonance or Oculus spatialization plugins. Unfortunately these plugins aren’t available for WebGL, they would need to be ported over. I can log a feature request for Resonance to be port, for Oculus you’d need to contact them for availability.

Hi Mathew,

Thanks so much for your very quick response!

Initially I was using the Resonance Audio plugs for ambisonics. Then I switched over to the native FMOD Spatialiser plugins for that reason, assuming that the native plugins achieved the same effect? Unless they do something different?

I’m also assuming that a feature request would take a few months at least to be implemented if WebGL would want to go ahead with it?

Thanks again for your time.

The FMOD native spatializer will interpret 1st order Ambisonics as a 4 channel (quad) audio file (not what you want). You must use a plugin that supports Ambisonics to get the desired result. Getting Resonance working on WebGL is not a trivial task and in-fact impossible with its current architecture (it uses threads which aren’t available on the web). Unfortunately I don’t see a way forward for you using WebGL and Ambisonics.

No worries. Thanks for that info.

Does the ‘quad’ audio format work for a WebGL bounce? I’m getting some errors in my build attempt, which I’m not sure are FMOD related.

Cheers,

Quad should work fine in WebGL, it’s just a four channel audio file, should work as well as stereo or 5.1 for that matter. What errors are you getting?

Beauty. Here are the errors I’m getting:

Cheers,

  • Tom

Could you press the little “three vertical dots” button in the lower right of the main scene view and click “Open Editor Log”, then send the contents of it? Hopefully that will give some more detail than the image provided.

No worries. Here is the editor.log

Hopefully it’s not too hard to sift through!

Thanks again for your time in helping me out with this

Cheers,

  • Tom

Editor.log (149 KB)

The relevant error appears to be:
stderr:error: Linking globals named '_ZTVN4FMOD19AsyncCommandPrinterE': symbol multiply defined!ERROR:root:Failed to run llvm optimizations:

It sounds like you might be linking FMOD twice, possibly the “L” logging and non logging version?
Check the settings for libfmodstudiounityplugin.bc and libfmodstudiounitypluginL.bc and make sure you aren’t using both (one or the other). See our docs for how to switch static libraries on and off.

Hi Mathew,

Okay great. That has gotten a consistent successful build out of Unity, so thank you for that!

There is still no audio coming through, though…

I have switched between applying the libfmodstudiounity plugin and libfmodstudiounitypluginL when building and neither produce sound in the build.

Is there anything in my FMOD settings in Unity that I am doing wrong?

All I have in my FMOD session is the three 4-channel audio files with an FMOD spatializer on the master.

I get audio in both FMOD and Unity, just not in the build.

Cheers,

  • Tom

Is it possibly because WebGL is single threaded, so it is having trouble with some of the parameters I have in my FMOD project? I have 3 parameters in my project which change the sound depending on the horizontal + vertical orientation and whether the player moving or not.

Cheers,

  • Tom

Hi Mathew,

Just double checking whether you received my last email?

Cheers,

  • Tom

does your browser session have an interaction? Chrome audio won’t allow audio unless it is triggered from a mouse / finger interaction.

No sound in Unity WebGL build should provide context.