I managed to create a HTML5 WebGL build of my Unity project using FMOD and everything works fine when I load it locally on Firefox. However, when I upload the project to itch.io, there’s no sound. I’ve tried Chrom, Firefox and Opera, none of those give me sound.
Is there something I’m missing? I have followed all the instructions of the documentation. I am using libfmodstudiounityplugin.bc. FMOD 2.00.09 (Unity Verified) and Unity 2019.2.21f1 Personal.
Hi Raphael,
Thanks for that . I can see how you dont get sound, it looks like the broswer ‘click / interact to get audio’ is not being used. Try clicking on the unity logo as it starts up and you will get sound.
With web browsers, you will have to cause the mixerSuspend/resume code in FMOD to be called from user input, you can make a prompt in your own app to make this happen.
if you get crackling you might want to look at altering buffer sizes with lowlevelSystem.setDSPBufferSize in the same .cs file where setOutput/setSoftwareChannels/setSoftwareFormat etc are called.
FMOD does not run in a thread so if the framerate is slow, it may miss mix opportunities to keep a continous stream.
Hi brett,
I try to change le DSPBufferSize, but nothing change, i have always the crackling effect with Chrome.
I add this : result = coreSystem.setDSPBufferSize(2048, 8); in the RuntimeManager.cs
But no effect, i use FMOD 2.00.10 and Unity 2019.3.13
It’s on the Initialize function
result = coreSystem.setAdvancedSettings(ref advancedSettings);
CheckInitResult(result, “FMOD.System.setAdvancedSettings”);
result = coreSystem.setDSPBufferSize(2048, 8);
CheckInitResult(result, “FMOD.System.setDSPBufferSize”);
if (!string.IsNullOrEmpty(Settings.Instance.EncryptionKey))
ok im guessing your update is not calling fast enough. Are you loading from file or stalling updates in any way? Strip back your own code and just let the sound play with nothing else happening to make sure it is not the game code.
HTML5 audio mixing has to be treated very carefully compared to a normal platform, as there are no background threads.
I’m not doing anything special, just call StudioEventEmitter and I don’t limit the FPS.
It’s really just on Chrome that it does that.
And i don’t understand this question "Are you loading from file or stalling updates in any way? ", i load my bank by the Streaming Assets folder, and in the FMOD settings i select specific bank to load with Master.strings & Master in first.
You can try the version here http://noisette.guillaume.free.fr/Sadhana
hi,
your demo actually played without any glitches for me. It might be to do with the speed of the CPU.
by loading - i mean your own game data… not just fmod loads.
I wanted you to test it with nothing but sound playing, and no gameplay. ie a black screen.
If that works, and you reintroduce gameplay elements and it starts stuttering , then that is the thing to look at.
This is the point i’d start looking at the profiler in the browser and see what is throttling the audio.
I finally found the problem, it comes from having several cameras in perspective in the scene…
So many PostProcess was applied and so many ressources allow to that
Yeah I run into similar problems, especially long ambient sounds are crackling.
I do have multiple cameras, and it does seem to get worse where more particles are on screen.
Frame rate is really fast though, so I don’t know what’s up. I’ll try if enabling / disabling Graphics Jobs helps.
Ideas suggestions welcome. I am still learning Unity/C#/FMOD and so still have a learning curve to surmount - despite having decades in scientific programming where all I needed was a good editor and a trusty compiler!
Thanks. I already know about that. The problem resides in one or more of the following:
whether user interaction is detected in a particular browser (engines and settings vary)
the kind of WebGL build (I had not had trouble having audio using Unity without FMOD in other projects)
the Win64 build is fine with audio provided by FMOD
what counts as user interaction (WASD and arrow keys?) or is there some other interaction required?
It’s not on my top list of priorities as I have a lot of other tasks which are more urgent - but I probably will try a really basic Unity project some time to help track the issue.