Wasapi Starvation: Single Car Engine Event used across lots of traffic - Instances and Stealing - Oldest/Furthest/Virtualize etc

So I’ve got one engine event, attached to all the traffic prefabs in unity.

I’ve set the instances to 2, and tried both stealing oldest, furthest, quietest, but i can only hear the engine sounds from 2 of the cars. The stealing isn’t working as you get closer to/further from other cars.

There are only two ways I can get audio from all the traffic.

  1. Setting stealing to virtualize, and
  2. setting the instances to infinite.

But both these ways create wasapi starvation.

If I set the stealing to oldest/quietest,furthest, the wasapi starvation stops, but again, I only hear audio from max 2 of the traffic cars, and the rest produce no audio at all.

The event has all the engine audio on the RPM parameter sheet.

Can anyone explain to me what I’m doing wrong?

Thanks so much

Hi,

What version of FMOD are you using and what engine are you using to make the project?

Hi Conner, I’m using 2.02.07 fmod, and Unity.

I’m going through the optimization documentation at the moment. I’m trying some ogg vorbis encoding to bring the sample rates down.

After some reading, it makes sense that virtualize is the only one that works due to it being a looping sfx.

I think I might have solved the wasapi starvation error.

But I’m getting this one still →

[FMOD] AsyncCommandBuffer::growBuffer : Growing command buffer to 65536 bytes. Initial command buffer size can be tuned to avoid dynamic growth using Studio::System::setAdvancedSettings()

UnityEngine.Debug:LogWarning (object)
FMODUnity.RuntimeUtils:DebugLogWarning (string) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:558)
FMODUnity.RuntimeManager:DEBUG_CALLBACK (FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr) (at Assets/Plugins/FMOD/src/RuntimeManager.cs:81)
FMOD.Studio.EventInstance:set3DAttributes (FMOD.ATTRIBUTES_3D) (at Assets/Plugins/FMOD/src/fmod_studio.cs:1337)
FMODUnity.RuntimeManager:Update () (at Assets/Plugins/FMOD/src/RuntimeManager.cs:449)

So this issue may be caused by a Behaviour Setting in the FMOD Settings:
image
This will stop any event that is further than their max distance from any listener (Unity Integration | Settings). Could you check whether this is enabled or not?

Hi Conner! Thanks so much,

Yeah, that setting wasn’t enabled.

I’ve enabled it now, and it seems to have helped, but it’s causing another issue.

The main player car keeps restarting.

I have an engine event, and an “engine total” event. The “engine total” event is what is attached to the main player car’s prefab.

A spatializer is on the engine event, and the engine total event has no spatializer cos it contains stereo audio I don’t want spatialized.

That “engine total” event without the spatializer keeps restarting, even though the car is the same distance from the camera at all times.

It stops happening when I disable the “stop events outside max distance” setting.

I’m sure this is probably something to do with how ive set up fmod.

Do you have any ideas…?

Thanks!

Hi,

Leave the option as disabled, I was just checking what you had it as. Would it be possible to run a profiler session (FMOD Studio | Profiling), focusing on what the voices are doing e.g. how many are real and how many are virtual? This might help us get close to the issue.

Hey Conner, I ran a profiler session, and uploaded it to my google drive → {8c08479a-b956-4b47-8a21-b83e481aff9b}.zip - Google Drive

I wanted to let you know, after doing some reading in the fmod optimization documentation, I did a bit of compressing/encoding of a lot of audio with ogg vorbis, and am no longer getting wasapi starvation errors in unity. I was bouncing all my audio at 48k, which I think was causing the problem.

But I was wondering if you could still please take a look at my profiler and let me know if you see anything that I should be concerned about?

Hey conner any info about this profiler? The team are still saying they are getting short freezes in game as things load, but I’m unsure if it’s because of the audio or not

Hi,

My apologies, I should have linked the documentation for packaging a Profiler session here FMOD Studio | Profiling.

This could be solved by enabling the Load Bank Sample Data option in the settings (Unity Integration | Settings), “This will reduce latency whenever an event is played for the first time, at the cost of using more memory.”

Hey, thanks for that conner. Ive read through the documentation, but i’m unsure how my voices, instances, and lifespans are looking compared to what would be considered standard in the industry.

I was told in another thread around 5% CPU with minimal sounds and 25%CPU maximum sounds is acceptable.

I also read through this → https://fmod.com/docs/2.02/api/platforms-win.html#performance-reference

But I am unsure about the number of “instances”, “voices”, and “lifespans” I have coming up in the profiler recording.

Does it look acceptable in the screenshot I attached?

Thanks!

Hi,

It will entirely depend on your situation. You can read about the Virtualization System under FMOD API | White Papers - Virtual Voices. But in summary, the system can handle hundreds or even thousands of voices at once. So sitting at 512 is fine, where it would be a concern is if they are all being created at the same time.

Hope this helps!

Thanks Conner, how do I avoid them all being created at the same time? For example, lets say theres 20 traffic cars, all with one event being virtualized. You load into the map, and they all load, im assuming… Is there a way to get only the closest to load first or something?

Hi,

Apologies, I should have been more specific. Loading in 20 sounds is fine, it would be when you are approaching the multiple hundreds of sounds. So in your situation, it sounds fine!

1 Like