Music hitching with "Starvation detected in WASAPI output buffer!" warning

So I’ve got an issue where when my game gets particularly busy towards the end game the sound - most noticeably the music - starts ‘hitching’, and FMOD spits out the “Starvation detected in WASAPI output buffer!” warning. Now, I’d be the first to admit that my games CPU usage can get a bit spiky - it’s a city-building game, so as things get busy the underlying simulation can take a lot of work. I’m working on ways to optimise and smooth out the CPU usage, but in the mean time are there any suggestions of what I might be able to do to make the music play more smoothly?

I’ve run the game attached to the FMOD profiler, and can’t see any issues:


In particular, there’s no spikes in the profiler to match up with the hitches or anything like that. I’m aware from reading the forums that this error tends to be a warning that something else is wrong, but I’m not seeing any other warnings, and running with the logging level turned up produces so much info that I can’t find anything useful in it!

For the music events, try setting their priority to the Highest setting. This will prevent any instruments within the event from being stolen or prioritized over other sounds.

You might also want to look into putting an instance limit on certain events and/or buses to ensure it doesn’t get too busy both audibly and with resource usage.

If you’re able to share the profiler session that might help understand what this “hitching” could be, if the above doesn’t help.