Introduction
I have always used Blend Containers to play multiple sounds that are associated with the same game object but I have always wondered if it is bad practice or inefficient in terms of optimization / CPU to use a Blend Container this way, or if it’s better to use a single Event associated with multiple play actions.. So, I decided to put this to the test!
My findings were that an Event with a single play action via a ‘Blend Container’ is always cheaper on the CPU than an Event with multiple play actions for Wwise ‘Sound SFX’.
There are two tests, each test has 2 parts.
Part A = Play Event for ‘Sound SFX’
Part B = Play Event for ‘Blend Container’
Test One
For Test One I fire 1 Event that has 90 play actions that each play a unique Sound SFX for the ‘Sound SFX’ test and I fire 1 Event that has a single Blend Container’ that has 90 unique Sound SFX’ inside it. Both A and B use 90 unique voices.
1A - Single Event, Multiple Play Actions (90 ‘Sound SFX’ Sounds)
1B - Single Event, Single Play Action (‘Blend Container’ With 90 Sounds)
Test Two
For Test Two I fire 3 Events at the exact same time. There are Three Events that have 30 ‘Sound SFX’ play actions per event, and Three events that have a single Blend Container, each with 30 sounds within them. Both A and B use 90 unique voices.
2A - Three Events, Multiple Play Actions per Event (30 ‘Sound SFX’ Sounds Per Event)
2B - Three Events, Multiple Blend Containers (1 ‘Blend Container’ with 30 Sounds Per Event)
Test Three
For Test Three I fire 1 Event that has 5 play actions that each play a unique Sound SFX for the ‘Sound SFX’ test and I fire 1 Event that has a single Blend Container’ that has 5 unique Sound SFX’ inside it. Both A and B use 5 unique voices.
3A - Single Event, Multiple Play Actions (5 ‘Sound SFX’ Sounds)
3B - Single Event, Single Play Action (‘Blend Container’ With 5 Sounds)
Test Four
For Test One I fire 1 Event that has 2 play actions that each play a unique Sound SFX for the ‘Sound SFX’ test and I fire 1 Event that has a single Blend Container’ that has 2 unique Sound SFX’ inside it. Both A and B use 2 unique voices.
4A - Single Event, Multiple Play Actions (2 ‘Sound SFX’ Sounds)
4B - Single Event, Single Play Action (‘Blend Container’ With 2 Sounds)
For these tests I made a new Unreal Engine 4 Project and integrated it with a new Wwise project.
There are 180 sounds in this Project:- -90 unique sounds for the ‘Sound SFX’ test. -90 unique sounds for the ‘Blend Container’ test.
I used the Profiler for each test to monitor the Total CPU at the moment the events were called, and the results were collected after each session by connecting to the capture log of each test and taking the CPU reading per Event (Appendix A). I did 30 Events per test as my sample size.
I use Play Events in the Unreal scene that are triggered via F keys in the Level Blueprint of the Audio Level. The events are played on the Player Camera Manager (Appendix B).
All sounds are unique .wav files that are then built in to Wwise Banks with the default conversion settings (Appendix C).
I am currently working on a Lightsaber UE4 project for fun that has lots of assets already designed and ready to use, so they are used for my test case.
Tech Spec
Unreal Engine 4.23
Wwise 2019.1
Intel i5-4590 3.30GHz
nVidia GTX 1660 Ti
16GB RAM
Windows 10
-----
Test One
Single Event, Multiple Play Actions (90 ‘Sound SFX’ sounds)
(there is 90, not 10 - they are offscreen to save space)
Single Event, Single Play Action (Blend Container with 90 sounds)
Test Two
Three Events, Multiple Play Actions per Event (30 ‘Sound SFX’ Sounds Per Event)
(each have 30, not 3 - they are offscreen to save space)
Three Events, Multiple Blend Containers (1 ‘Blend Container’ with 30 Sounds Per Event)
Test Three
Single Event, Multiple Play Actions per Event (5 ‘Sound SFX’ Sounds Per Event)
Single Event, Single Play Action (Blend Container with 5 sounds)
Test Four
Single Event, Multiple Play Actions per Event (2 ‘Sound SFX’ Sounds Per Event)
Single Event, Single Play Action (Blend Container with 2 sounds)
Findings
Test One & Two - Large Events
Test One is on the left, Test Two is on the right
Test One reports an average of 4.04% when the Event to play 90 sounds is called, and 3.35% when a blend container with 90 sounds inside is called.
Test Two reports an average of 4.29% when the three Events to play 30 sounds each are called, and 3.80% when the three blend containers each with 30 sounds inside are called.
Test Two is higher CPU than Test One, which is to be expected as although the voice count is the same, there are multiple event calls happening.
We can see that the results of the Blend Container CPU in Tests One and Two are significantly smaller than the Sound SFX CPU.
Test One shows that it is 20% more efficient. Test Two is 12% more efficient.
Test Three and Four - Small Events
Test Three is on the left, Test Four is on the right
Test Three reports an average of 0.69% when the Event to play 5 sounds is called, and 0.68% when a blend container with 5 sounds inside is called.
Test Four reports an average of 0.54% when the Event to play 2 sounds is called, and 0.52% when a blend container with 2 sounds inside is called.
We can see that the results of the Blend Container CPU in Tests Three and Four are, although negligible, still smaller than the Sound SFX CPU.
The results are very close, but it is still more efficient to use a blend container when multiple sounds are required.
I assume that the benefit of the CPU is because the Event is calling a single action rather than multiple actions that each have their own own values (target, fade, delay etc.)
(full table of results)
-----
Appendix A
Appendix B
Appendix C
Something to keep in mind is memory usage as well. I'm curious if using a lot of blend containers (or actor-mixers) adds a lot, memory wise. In the use cases you described it doesn't sound like blend containers are being used arbitrarily, but would be interesting to see some data on memory usage if blend containers or actor-mixers ran rampant!