Sound Effects tanking iPhone FPS

Hello, just wanted to ask if anyone has run into anything similar and has a fix.

Currently I’ve been adding sound effects to my game using the AudioEngineV2.

Everything was working fine on PC, but once I tried on iPhone, I noticed some framerate hiccups. Usually the game runs at a steady 60fps on iPhone, but in this case there were some visible drops to 58 causing stutters.

Then I tried on another mode of the game where there are lots of sound effects played, the result is clear fps drop to 48-53, even after all the sounds are done playing.

Has anyone run into this and knows the cause?

cc @docEdub

This can happen when multiple sounds are attached to meshes or other grahics objects.

By default the audio engine updates the spatial audio parameters on every frame to sync them with the graphics objects’ position and rotation. You can change how often the spatial audio parameters are updated by setting the sound.spatial.minUpdateTime property, or spatialMinUpdateTime sound creation option. The audio engine listener property’s spatial update time can be set similarly.

There are also sound and listener creation options to disable spatial auto update, in which case the sound.spatial.update function would need to be called explicitly to sync the sound’s position and rotation with the attached mesh.

Thank you for the ideas.

It looks like what happened in my case was I was initializing multiple audioEngines when switching game modes. When changing game modes in my game, the page url changes, but as it being an SPA, my code didn’t check if the audioEngine was already created and re-created it. This seemed to immediately cause perf issues in Safari.

1 Like