Just wondering if others who are working on 3D games/products are culling out 3D sounds manually on distance. I tried this in an effort to reduce the CPU overhead.
Here is a comparison:
Test 1 – with 100 bots and 64 channels and no culling
PlaySoundCallCount3d per second = 44.6
Average CPU from 90097 samples = 6.8
Test 2 – with 100 bots and 64 channels and with culling at 250m:
PlaySoundCallCount3d per second = 10.7
Average CPU from 58741 samples = 3.0
CPU samples come from getCPUUsage.
By culling I simply mean not calling playSound if beyond the cull distance.
There may be some audible sounds culled here but anyway I will need to use this, unless there is a better solution.
- fundictive asked 9 years ago
I don’t use linear falloff for any world-sim 3D sound; perhaps for 3D UI or other non-world 3D sources, but not where a semblance of real-world attenuation over distance is needed.
Best results will come from a variety of curves for different sound sources.
Apparent relative loudness of 3D sounds is not just their primary volume level, but also strongly conveyed through a well tuned fall-off curve that is appropriate for the given source. For instance, log may be closer to real-world attenuation over distance, but big noises such as explosions may benefit from a curve that is closer to linear.
I tend to use curves which are less steep than log in the near-mid range but then still drop down and taper out smooth. This creates a fuller mix of nearby sounds immediately around the listener and then shelves mid-long range sources down to put them into the background.
- jcobb answered 9 years ago
[quote="Dogbert":23wi6fqi]I imagine calling playSound 45 times per second is more intense than the channel virtualization code that handles them.
The CPU usage in our AAA title is next to nothing with 80 channels playing or so… but we only call playSound 4-5 times per second in intense areas of our game.[/quote:23wi6fqi]
exactly – 45 playsound calls per second is asking for trouble no normal title would be doing that, you should be culling a lot more playsound calls so that it does a lot less. You should be looking into soundgroups for this.
Linear vs log has nothing to do with this cpu usage.
I use linear roll off and I do use a check to either start/stop looped sounds or figure if I should play a "play once" sound.
I have not noticed any odd effects and my channel count is usually around 8…
110 active sound emmiting objects, max distance set to 300 units
Because of the speed of the listenner, sounds are usually started well within the non audible region.
Oh – I thought it would be common; if you have a hundred or more players moving around in an open environment, firing, making explosions, buildings destroyed – then there will surely be plenty of playSounds.
I’m sure I’ve read previous discussions where the advice was that culling would not be necessary, due to virtualization.
WRT soundgroups – if you are talking about max audible, then my only experience with that has been problematic; as I outlined in this unresolved discussion: [url:2pcg6uiw]http://www.fmod.org/forum/viewtopic.php?t=10288[/url:2pcg6uiw]
Are you using a lot of DSP effects? Or playing back compressed sounds with CREATECOMPRESSEDSAMPLE? I’ve found that at least half of the FMOD usage in my case was due to decoding in real time and the high and low pass filters being used on virtually everything
- mac_bug answered 9 years ago
I use neither.
It is a laptop-friendly game but fully 3D and with many players in an open environment. Audio CPU usage is very significant; perhaps that is reasonable; perhaps a layer of application-level optimizations is unavoidable with my requirements…
it is virtually negligible, a virtual voice simply does
position += timedelta;
then a few if statements to simulate looping or end of sound.
The only thing that is a bit more expensive is swapping from virtual to real, but that only happens when something enters or leaves the ‘sphere’ boundary that seperates the real and virtual voices.
If the voices are software mixed, then even swapping is almost free, but if it is hardware directsound overhead comes into it and that can be expensive, it doesnt like state changes.
We use the event system, but we were able to cut our FMOD main thread time in half by manually stopping/starting sounds that had gone beyond their max range from the listener. Even at it’s worst, FMOD was rarely more than a couple of ms, but on a console where main thread time is especially precious, this was a nice win. For us, the savings was both in update() time and in time saved calling API functions like getEvent() and set3dPosition(), functions which while small, do add up when you have a lot of active (but usually inaudible) sounds.
- audiodev answered 9 years ago
Forget 1000 voices. For my game CPU peaks at around 13 % under the following conditions:
- 64 channels
- software processing
- around 45 3D playSound calls per second
- 1 streamed music channel
Most of the sounds are explosions.
This is on a 1.7 GHz laptop running XP.
Is anyone else looking at CPU usage for their 3D game? Sure the documentation says that CPU will be low, but that is not what I see from the supplied function.
I imagine calling playSound 45 times per second is more intense than the channel virtualization code that handles them.
The CPU usage in our AAA title is next to nothing with 80 channels playing or so… but we only call playSound 4-5 times per second in intense areas of our game.
I am using log attenuation. Should I use linear attenuation? Will that effectively give me better CPU usage but still sound OK?
I did notice that even in the very far distance sounds are still audible.
Are you 3D guys all using linear?
Please login first to submit.