The following steps must be followed beforehand to successfully complete the Spatial Audio Tutorials :
| Note: | If you don't want to start a new project from scratch, you can download the Wwise Demo Scene from the Audiokinetic Launcher. It contains a scene called SpatialAudioTutorial, with all the steps from the tutorials. For more information, see Wwise Demo Scene. |
1. Create a Unity Project
Using the latest version of Wwise and Unity, follow the steps below in order to build your working environment.
- Launch Unity and create a new project.
- Close Unity.
- Start the Audiokinetic Launcher and integrate Wwise into your Unity project.
2. Wwise Project Preparation
For the tutorials, you will need a Sound SFX, an Event to play it, and a SoundBank.
- From the Launcher, open your project in Wwise.
- Add a Sound SFX under the Actor Mixer Hierarchy's Default Work Unit.
- Import a sound into it.
- In the Sound Property Editor's
- General Settings tab, enable Use game-defined auxiliary sends.
Sound Property Editor General Settings tab
- Positioning tab, enable Listener Relative Routing and select Position + Orientation for the 3D Spatialization. Add an Attenuation with a reasonnable Max Distance.
Sound Property Editor Positioning tab
- Right-click on the Sound SFX within the Actor-Mixer Hierarchy, then select New Event > Play.
Event Editor
- Go to the SoundBank layout (shortcut F7) and add a new SoundBank. Drag the Event into the new SoundBank.
- Save your project.
3. Unity Project Preparation
In this section we will create our game area and the objects in it. We will need a listener, emitters, and two rooms.
From the Launcher, open your project in Unity. Open the Wwise Picker (Windows > Wwise Picker), Refresh Project, and Generate SoundBanks.
Wwise Picker
- Create a character with the method of your choice.
- Remove any Unity Audio Source.
- Add an AkSpatialAudioListener component to the GameObject acting as your listener.
AkSpatialAudioListener component
- Adding an AkSpatialAudioListener component will automatically create an AkAudioListener, AkRoomAwareObject and AkGameObj component.
AkAudioListener component
AkGameObj component
AkRoomAwareObject component
- In the AkGameObj component,
- Uncheck the Environment Aware checkbox.
- Enable the Use Default Listener option.
- In the AkRoomAwareObject component you may see up to two warning messages. Since we are not yet using AkRoom components, you can ignore them for now. We'll come back to it in the Rooms and Portals Tutorial. You can disable the component if you are not planning to use AkRoom components at all in your game.
- Create a floor, a building with two rooms and an obstacle outside using your preferred method.
In the SpatialAudioTutorial scene, we used a mesh for the building and cubes for the floor and obstacle ( GameObject > 3D Object > Cube ).
SpatialAudioTutorial Scene
- Create emitters with the method of your choice. In the Wwise Unity Demo Scene, we created buttons using cylinders ( GameObject > 3D Object > Cylinder ). We added a button outside and inside each room.
For each emitter:
- Add an AkAmbient component:
- Choose your preferred way to start the sound in Trigger On.
- Choose the Event in Name.
AkAmbient component
- In the AkGameObj component (added automatically after adding an AkAmbient component):
- Enable the Use Default Listener option.
AkGameObj component
- Add an AkBank component:
- Add the SoundBank created in the previous section to Name.
AkBank component
4. Verify your Setup
- Start the game and connect it to Wwise,
- Open the Profiler layout (shortcut F6).
- Play the sound from a button. You should hear the sound you imported in the Wwise project.
- In the Voices Graph tab, you should see the following graph:
Button Outside Voice Graph with no Effect
- In the Profiler settings, reachable from the gear icon in the top right corner of the Advanced Profiler view, make sure Spatial Audio is selected to be able to see Spatial Audio drawings in the Game Object 3D Viewer (next step).
Profiler Settings
- Open the Game Object Profiler Layout (shortcut F12)
- In the Game Object 3D Viewer, you should see your game objects. Note that game objects that have not emitted yet won't appear in the viewer.
Game Object 3D Viewer
- Save your Scene to a convenient place.