Using States
Use cases for States in both Wwise and Unreal will be shown on this page.
States are a type of game sync in Wwise that are useful for applying immediate or gradual transitions in your soundscape. This tutorial will show the process of setting up States in Wwise, applying them to your sound, and implementing the effect in your game engine.
Unreal
Setting Up In Wwise
Here is the scenario: In the French75 scene, you have a bunch of ambient sounds that complement the void-like setting and are echoes of the past. When the player has loaded the shell, pulls the cable, and fires, you want all ambient sounds to immediately duck out so that the firing sound is fully embraced. As the firing sound fades off, the ambient sounds can slowly creep back in. To achieve this effect, we are going to use States, so let's start in Wwise and see how this is set up.
In my Wwise project, I have my Ambiances as children objects under the INTRO_LEVEL Folder, for organizational purposes. In the first scene of the French75 experience, this is where the sounds first come into play, which are later reused in the French75 scene. I decided to separate sounds specific to the French75 scene in a different folder.
The only sounds I am worried about are my ambient sounds, which have been color-coded yellow. These are what will duck out when the cannon is fired, so we're going to set up states for them in the Game Syncs tab.
Under the States hierarchy in the Game Syncs tab, I selected the default work Unit and created a State Group called "Cannon_FireAmbience". The state group object is what will hold our states, I have created two states: Fired, and Not_Fired.
The State Group object is what you will select in order to set up transition times from one state to the other. My vision for this state group's usage is that transitioning from Not_Fired to Fired should immediately fade out the audio, whereas, after firing, the Not_Fired state will be reapplied and provide a short fade-in of the ambient sounds.
I set up the aimed-for transitioning system by clicking insert at the beginning of the property editor and defining my states under the From and To properties.
The transitions can now happen but as of right now, have not been applied to any of the sound objects, nor have we said what should change during the transition: Volume? Lo Pass? Pitch?
Rather than apply the state transition to however many Ambient parent objects would need it, I can filter my ambient sounds to an audio bus so that I can apply states to that Audio bus and it collectively affects all the ambient sounds I have routed to it.
You can create an Audio Bus in the Master-Mixer-Hierarchy in the property editor. Click the default work unit and then select the icon that identifies as Audio Bus. (Shortcut: Ctrl + Shift + Alt + B)
I named my Audio Bus "Ambience_Compressor" This is because I have a compressor effect being applied to all sounds that pass through this bus, and I wanted to also identify that any sounds filtered to this bus are solely ambient sounds.
To route your sounds to a different bus, click the object you want to route and in the Property Editor's General Settings tab, go to the Output Bus section and find your desired bus in the directory pulled up by the three dots button. I have my ambient sounds linked to an Actor Mixer object as the parent. Because of this, I am able to route all sounds at once to the Ambience_Compressor bus, simply by pulling up the General Settings for the Actor Mixer object and routing that to the Ambience_Compressor Bus. (I did this for 3D_Weaponry and Ambience)
Whatever you decide to do, click the object you need to apply the State transitions into. In the Property Editor, click the States tab. Click Add State Group>> and find the State Group you want and select it.
It will appear in the view with the states that are connected to it. My sounds are being influenced by effects, so you might notice that I have checked the Bypass Effects checkbox, in order for the transition to do what I want. As for what I want, I have specified in the Fire State's properties that the volume should be lower and that a Lo Pass filter should be applied.
Under the Change Occurs at Property, I have specified that it should be Immediate. THIS DOES NOT MEAN AN IMMEDIATE CHANGE IN DYNAMICS, rather it means the state transition should happen immediately though the time we specified in the Game Syncs time will still be however long you set it. For example, in my transition from Fired to Not_Fired, I told the State Group to take 7 seconds to transition into Not_Fired. When the state is called in the game it will be immediate, but the change from Fired to Not_Fired will take seven seconds, dynamically speaking.
You can test if your system works with the transport control view at the bottom of your project. Click the State Group Icon, which is the orange Icon in the image above, and the state group for the sound you selected and wish to test should appear. If it hasn't make sure you gave it a state group.
Now play your sound and in the dropdown menu that says none, select one of your states. The transition should begin immediately, and at the speed you gave it in your State Group's editor.
If you're happy with your configurations, go to the Events tab in the Property Editor. Create an event with whatever naming convention works for you. I have my ambiances as children objects under a separate work unit, for organization purposes.
Keep the view for your event open after selecting and navigating to the Audio tab to locate the sound you want applied to this event. Be sure not to click any audio objects during this process, or else the view you need to drag it into will disappear. Drag your audio object into the event view area and it should appear in the view with some information.
Alternatively, you can click the Add>> button at the bottom of the Event View, then find the sound object you want to add.
Finally, go to Layouts --> Soundbanks , and find the soundbank you want to put your event into. Once selected, navigate to the Event Viewer in the bottom left and locate the Event(s) you want to drag and drop into your soundbank. Once you do that, it should appear in the Hierarchy Inclusion view.
Click Generate All in the top right, or you can do Generate Checked if you only want to update specific things. Save your project and you're now ready to move to Unreal!