Hello! My company wants to use FMOD for new games. I am developing a PoC and I am interested in how often Studio::System::update should be called. I am trying to do this in requestAnimationFrame and then the calls occur approximately every 16.6ms. This works well except when the main browser thread executes some code for a longer time. In this case, when the interval between calls increases to 18-22ms, I hear sound artefacts: crackles, pops, etc.
So is it really true that a uniform Studio::System::update call frequency is very important?
If so, are there any other ways to make it more uniform in a web application?
I tried using setInterval with a frequency of 50ms. This also works until the interval increases to 55-65ms, at which point I hear the same horrible artifacts.
I would be very grateful for your help, our company has high hopes for FMOD.
It isn’t the call frequency of Studio::System::update
that would be causing the crackling, rather the cracklng and stalled update
call are both separate side effects of the slow operation. Calls to update
are for updating 3D positions, triggering callbacks etc, and the mixer will run independently of calls to update
, so strictly uniform update
calls are not necessary.
As for the crackling, HTML5 doesn’t have good support for threads, so the mixer can be blocked by work that would be trivial on any other platform. There are a few things you can do to workaround this performance limitation:
- Increase your DSP buffer size, which will increase latency, but reduce stuttering.
- Enable the
Cross-Origin-Opener-Policy: same-origin
andCross-Origin-Embedder-Policy: require-corp
policies in your server header. This will enable a fast code path which uses a SharedArrayBuffer. - Use https instead of http for your website. This will allow the faster
FMOD_OUTPUTTYPE_AUDIOWORKLET
output type to be used.
Please give those optimizations a go and let me know if you are still getting stuttering when the browser’s workload increases.
Thank you for answer!
Today I discovered that the issue with stuttering appears only if chrome dev-tools page is opened. Without it all looks pretty smooth. So probably my problem is not really… a problem.