Table of Contents

Using Wwise Spatial Audio in Unreal

This tutorial presents new functionalities introduced by Wwise 2017.1 and the new Spatial Audio features introduced in the Unreal plug-in. It explains the workflow to integrate spatial audio components in a game, and provides technical information about initializing spatial audio features (such as 3D busses, 3D positioned Sound SFX, or the Reflect Effect plug-in) in the Wwise Authoring Tool and importing the Spatial Audio component in a game using the Unreal Engine.

It is assumed that the reader has a basic working knowledge of Wwise and the Unreal Engine. However, the content of this document is detailed enough for users of any level of expertise to complete this tutorial. Further information can be obtained from the Unreal Documentation.

Throughout this tutorial, four different virtual acoustic zones will be created, each of these virtual acoustic zones demonstrates one capability of the new Spatial Audio plug-in. Each area has an ambient sound placed at its center that acts as an emitter. The listener is left as the default and corresponds in this case to the camera, which can be moved around to explore the different acoustic environments.

Sections A, B, and C are required steps to build a proper working environment and are expected to be completed in this specific order. Any of the following sections (namely D, E, F, and G) can be completed separately and independently in any order, once the three first sections are completed.

Note: Completion of sections using the Reflect plug-in require the appropriate license.

A - Setting Up The Project

Using the latest version of Wwise and Unreal, follow the steps below in order to build your working environment.

  1. Launch Unreal 4.16.1 from the Epic launcher
  2. Create a new Unreal Project C++ Blank project (without starter content) called TestSpatialAudio.
  3. Close Unreal.
  4. Start the Wwise Launcher.
  5. Install Wwise 2017.1.0.
  6. Select the Unreal Engine tab.
  7. Click the Integrate Wwise into Project... button.
  8. Launch Wwise using the Open in Wwise 2017.1 button.
  9. Launch Unreal using the Open in Unreal 4.16.2 button.

B - Preparation

In this section, we are scaling the floor and setting up walls and portals to delimit four different areas that will correspond to the different acoustic environments in which we will put the spatial audio components.

  1. Select the floor and set a new Transform.
    • Set Location to (x=0.0, y=0.0, z=0.0).
    • Set Scale to (x=2.0, y=2.0, z=1.0).
  2. Create walls using 8 cubes with the following dimensions and locations:
    • Location (x=775.0, y=0.0, z=100.0) Scale (x=4.5, y=0.25, z=2.0).
    • Location (x=225.0, y=0.0, z=100.0) Scale (x=4.5, y=0.25, z=2.0).
    • Location (x=-225.0, y=0.0, z=100.0) Scale (x=4.5, y=0.25, z=2.0).
    • Location (x=-775.0, y=0.0, z=100.0) Scale (x=4.5, y=0.25, z=2.0).
    • Location (x=0.0, y=-775.0, z=100.0) Scale (x=4.5, y=0.25, z=2.0) Rotation (x=0.0, y=0.0, z=90.0).
    • Location (x=0.0, y=-225.0, z=100.0) Scale (x=4.5, y=0.25, z=2.0) Rotation (x=0.0, y=0.0, z=90.0).
    • Location (x=0.0, y=225.0, z=100.0) Scale (x=4.5, y=0.25, z=2.0) Rotation (x=0.0, y=0.0, z=90.0).
    • Location (x=0.0, y=775.0, z=100.0) Scale (x=4.5, y=0.25, z=2.0) Rotation (x=0.0, y=0.0, z=90.0).
  3. Move Player start to:
    • Location (x=-500.0, y=-500.0, z=100.0).
  4. In order to help differentiate the rooms, add the following PointLights at the specified locations with Intensity set to 50,000:
    • Red, Location (x=-500.0, y=-500.0, z=500.0).
    • Blue, Location (x=500.0, y=-500.0, z=500.0).
    • Green, Location (x=500.0, y=500.0, z=500.0).
    • Yellow, Location (x=-500.0, y=500.0, z=500.0).
  5. Save as "NewMap".
    part_b_1_map.png

    Build working environment

C - Add Reference Sound in Unreal

The first zone introduces a 3D positioned sound which should be panned and occluded/obstructed accordingly as the listener is moving around the source. Occlusion/obstruction occurs when the listener (namely, the main camera) moves outside the area and hides behind opaque components such as a wall, a floor, or a ceiling.

  1. In the Wwise project, create a new Sound SFX in the Default Work Unit of the Actor-Mixer Hierarchy, name it ReferenceSound, and import an impulse sound.
    part_c_1_sound_sound_sfx.png

    Create Sound SFX

  2. Make sure to enable Use game-defined auxiliary sends with positioning enabled and type set to 3D.
    part_c_2_sound_sound_positioning.png

    Select positioning type

  3. Create the associated Event "PlayReferenceSoundTest", and drag and drop the "ReferenceSound" voice into it.
    part_c_3_sound_event.png

    Create sound Event

  4. Save the project.
  5. In Unreal, open Window > Wwise Picker and drag the "PlayReferenceSoundTest" Event into the Content Browser.
    part_c_4_wwise_picker.png

    Drag from Wwise Picker to the Content Browser

  6. Double click the "PlayReferenceSoundTest" and create a new SoundBank called "TestSpatialAudioBank" directly from the SoundBank list.
    part_c_5_create_sound_bank.png

    Create SoundBank

    part_c_6_select_sound_bank.png

    Select SoundBank

  7. Drag the "PlayReferenceSoundTest" Event into the scene to create a new AkAmbientSound.
    • Set Location to (x=-500.0, y=-500.0, z=100.0).
      part_c_7_drag_event_as_akambiant_sound.png

      Create AkAmbientSound

  8. Open Level Blueprint from the Blueprints menu and remove "Event BeginPlay" and "Event Tick".
  9. Drag the newly created "PlayReferenceSoundTest" item from the World Outliner into the blueprint.
  10. Right-click the blueprint background and search for "Left Mouse Button".
  11. Right-click the blueprint background again and search for "Post Event".
  12. Connect the Pressed outlet to the Post Event Exec and the "PlayReferenceSoundTest" component to the Actor inlet.
  13. Select the "PlayReferenceSoundTest" AkEvent in the Post Event.
    part_c_8_blueprints.png

    Add user input to trigger ambient sound

  14. In the upper menu, select Build > Generate SoundBanks.... to generate the SoundBanks for Windows.
    part_c_9_generate_sound_banks.png

    Generate SoundBanks from build menu

  15. Make sure the banks are successfully generated in the Ouput Log.
    part_c_10_output_log_generate_soundbank.png

    Output Log for SoundBank generation

  16. Start the scene. You should now hear the sound play, spatialized in 3D, when pressing the Left Mouse Button.

D - Add Late Reverb

The second area is a demonstration of using an AkSpatialAudioVolume to include a Late Reverb applied to an AkAmbientSound inside a contained area.

  1. In the Wwise project, create an Auxiliary Bus called "TestReverbAuxBus" under the Master Audio Bus.
    part_d_1_create_aux_bus_no_game_defined.png

    Create an Auxiliary Bus for reverb

  2. Add a Wwise RoomVerb Effect and use the Cathedrals > Holy predefined ShareSet.
  3. Create a second Event called "PlayLateReverbTest" and drag the "ReferenceSound" Sound SFX on it.
    part_d_2_create_play_test2_event.png

    Create Play Event

  4. Save the project.
  5. In Unreal, drag an AkSpatialAudioVolume volume in the scene from the Volumes selection.
    • Set Location to (x=500.0, y=-500.0, z=100.0).
    • Set Scale to (x=5.0, y=5.0, z=1.0).
      part_d_3_create_new_akspatial_audio_volume.png

      Create new spatial audio volume

  6. Make sure only Enable Late Reverb is enabled and that Enable Surface Reflectors and Enable Room remain disabled for this AkSpatialAudioVolume.
    part_d_4_select_enable_late_reverb.png

    Select 'Enable Late Reverb'

  7. Drag the new TestReverbAuxBus and PlayLateReverbTest from the Wwise Picker into the Content Browser.
    part_d_5_wwise_picker_drag_auxiliary_bus_and_audiokinetic_event.png

    From Wwise Picker, drag Auxiliary Bus and Event

  8. Double-click the PlayLateReverbTest and assign it to TestSpatialAudioBank.
    part_d_6_assign_banks.png

    Adding bus and Event to bank

  9. Select the new AkSpatialAudioVolume and set the aux bus to TestReverbAuxBus in the Late Reverb section
    part_d_7_select_late_reverb_aux_bus.png

    Select late reverb aux bus

  10. Drag the "PlayLateReverbTest" Event into the scene to create an AkAmbientSound.
    • Set Location to (x=500.0, y=-500.0, z=100.0).
      part_d_8_add_event2_into_the_scene.png

      Add Event into the scene

  11. Reproduce steps C-11 to C-13 for PlayLateReverbTest to trigger the sound. (You can map a keyboard key instead of a mouse button.)
  12. Regenerate the SoundBanks.
  13. Start the scene and go inside the volume. Triggering PlayReferenceSoundTest should result in a sound with reverb applied on it.

Note: If Enable Room is checked for the AkSpatialAudioVolume, the Auxiliary Bus containing the reverb must have 3D positioning enabled as well.

E - Add Surface Reflector

The third area demonstrates surface reflectors that are used to simulate the early reflection implied by the propagation of sound in an acoustic environment. The wave propagation is modeled using the image-source method which derives from the game geometry the appropriate time delay (distance), amplitude, and filter parameters in order to recreate a realistic acoustic environment. Real time computation evaluates the different paths acoustic waves take to reach the relative position of listeners in reference to sound emitters. The resulting effect provides a strong sensation of space of the acoustic environment. One can actually see the reflection through the Wwise Reflect Effect Editor, which displays a distance/amplitude representation of each reflection.

  1. In Wwise, create a third Event called "PlayReflectTest" and drag the "ReferenceSound" Sound SFX on it.
    part_e_1_create_event_in_wwise.png

    Create new Event in Wwise

  2. Create an aux bus Called "TestReflectAuxBus" on the Master Audio Bus and put a Reflect plug-in on it.
    part_e_2_add_reflect_to_aux_bus.png

    Create new Event in Wwise

  3. Make sure to select Use game-defined auxiliary sends and enable 2D positioning for this bus.
    part_e_3_enable_2d_positionning.png

    Enable 2D positioning for Auxiliary Bus

  4. Set Reflect's Max Distance to 10,000 and Speed of Sound to 34,500.
    part_e_4_set_speed_of_sound.png

    Set Reflect Speed of Sound and Max Distance

  5. Save Project
  6. In Unreal, drag and drop the PlayReflectTest and TestReflectAuxBus from the Wwise Picker into the Content Browser
  7. Double-click the PlayReflectTest Event and assign it to the TestSpatialAudioBank.
  8. Drag and Drop the PlayReflectTest into the scene to create an AkAmbientSound:
    • Set Location to (x=500.0, y=500.0, z=100.0).
  9. Drag n drop a AkSpatialAudioVolume into the scene
    • Set Location to (x=500.0, y=500.0, z=100.0).
    • Set relative scale to (x=5.0, y=5.0, z=1.0).
  10. Make sure that "Enable Surface Reflectors" is enabled, and that "Enable Late Reverb" and "Enable Room" remain disabled for this AkSpatialAudioVolume.
    part_e_5_add_spatial_audio_volume_with_options.png

    Add spatial audio volume to scene

  11. The PlayReflectTest AkAmbientSound should be inside the AkSpatialAudioVolume.
  12. Select the PlayReflectTest AkAmbientSound, go to the Spatial Audio option and set "Early Reflection Aux bus" to "TestReflectAuxBus".
  13. You can also enable Debug Draw and display 1st order reflections for this AkAmbientSound (in Ak Component > Spatial Audio > Debug Draw).
    part_e_6_event_spatial_and_debug_draw_options.png

    Debug draw option for reflections

  14. Reproduce steps C-11 to C-15 for PlayReflectTest to trigger the sound. (You can map a keyboard key, instead of a mouse button.)
    part_e_7_blueprints_add_user_inputs.png

    User input to trigger the sound

  15. Regenerate the SoundBanks.
  16. Start the scene and go inside the volume. You should see reflections being drawn and your sound being routed to an aux bus that uses the Reflect plug-in when triggering PlayReflectTest.

F - Add Rooms and Portals

In a realistic acoustic environment, portals (such as windows or any other opening) will act as new sources for any listener outside the acoustic volume in which a sound is emitted. AkAcousticPortals are useful to model this situation using an Auxiliary Bus to route the audible content of a volume and expose it as a new 3 dimensional source in an adjacent acoustic space.

  1. In the Wwise project, create a new Auxiliary Bus called "TestPortalAuxBus".
  2. Make sure to select Use game-defined auxiliary sends and to enable 3D positioning.
    part_f_1_create_aux_bus_3d_positioning.png

    Create new Auxiliary Bus with 3D positioning

  3. Add a Wwise RoomVerb Effect with Room_Medium parameters.
    part_f_2_add_reverb_to_aux_bus.png

    Add reverb to Auxiliary Bus

  4. Create a fourth Event called "PlayPortalTest" and drag the "ReferenceSound" Sound SFX on it.
    part_f_3_add_play_event.png

    Add new Play Event

  5. Save the project.
  6. In Unreal, drag and drop the PlayPortalTest from the Wwise Picker into the Content Browser.
  7. Drag and drop the TestPortalAuxBus into the Content Browser.
    part_f_4_drag_event_and_auxbus_from_wwise_picker.png

    Add Event and Auxiliary Bus to the Content Browser

  8. Double click the "PlayPortalTest" Event and assign it to the TestSpatialAudioBank.
    part_f_5_select_soundbanks.png

    Select SoundBanks for the Event

  9. Add a new AkSpatialAudioVolume.
    • Set Location to (x=-500.0, y=500.0, z=100.0).
    • Set Absolute Scale to (x=5.0, y=5.0, z=1.0).
  10. Select the "TestPortalAuxBus" as an aux bus in the Late Reverb section.
    part_f_6_add_spatial_audio_select_late_reverb.png

    Add the spatial audio volume to scene and select late reverb auxiliary bus

  11. Make sure the Enable Late Reverb and Enable Room are both enabled and Enable Surface Reflectors remains disabled for this AkSpatialAudioVolume.
    part_f_7_make_sure_room_enabled.png

    Make sure the room is enabled

  12. Add another AkSpatialAudioVolume.
    • Set Location to (x=-500.0, y=-500.0, z=100.0).
    • Set Absolute Scale to (x=5.0, y=5.0, z=1.0).
  13. Make sure Enable Late Reverb and Enable Room are both enabled and Enable Surface Reflectors remains disabled for this AkSpatialAudioVolume.
    part_f_8_add_audio_volume_enable_room.png

    Add a second audio volume and enable room

  14. Add a new AkAcousticPortal.
    • Set Location to (x=-500.0, y=0.0, z=100.0).
    • Set Scale to (x=0.5, y=0.5, z=1.0).
      part_f_9_add_acoustic_portals.png

      Drag a new acoustic portal into the scene

  15. Select the new Portal and set the initial state to Open in the "Ak Acoustic Portal" section.
  16. Also set the Acoustic Portal gain to 2.0 in the same section.
    part_f_10_make_sure_portal_is_opened.png

    Make sure the portal is opened

  17. Drag and drop the PlayPortalTest into the scene.
    • Set Location to (x=-500.0, y=500.0, z=100.0).
      part_f_11_add_event_into_the_scene.png

      Drag new Event into the scene

  18. Reproduce steps C-11 to C-13 for PlayPortalTest to trigger the sound. (You can map a keyboard key, instead of a mouse button.)
  19. Regenerate the SoundBanks for Windows.
  20. Start the scene and stay at the start location. You should hear the sound from the portal when triggering PlayPortalTest.

Note: When using portals, Enable Room must be checked for all AkSpatialAudioVolume using Late Reverb auxiliary send in order to restrain the reverb to that room only.

Note: If the world contains one or more spatial audio rooms, then the behavior of the occlusion/obstruction algorithm changes to utilize the additional information that spatial audio rooms provide. If the line-of-sight test between the emitter and listener fails:

  1. When the listener and emitter are in the same room, the Wwise obstruction filter (dry path only) is set.
  2. When the emitter and listener are in different rooms, the Wwise obstruction filter (both wet and dry path) is set.
  3. In the absence of spatial audio rooms, the algorithm assumes that all sounds that do not have a line of sight to the listener are occluded, and the Wwise occlusion filter (both wet and dry path) is set.

G - Add Spot Reflector

Spot reflectors are the last feature introduced in this tutorial and are mainly used to model singular acoustic reflections. They can be used to model distant virtual man-made or naturally created geographic features which create a singular distinctive acoustic echo. For example, mountains or large walls. A spot reflector can simply be dropped inside the environment for the engine to compute the appropriate acoustic delay between the emitter and the listener, based on the physical distance between their respective location and the point reflection.

  1. In the Wwise project, create a new Auxiliary Bus called "TestSpotReflectorAuxBus" and put a Reflect plug-in to it.
    part_g_1_add_new_auxbus_with_reflect.png

    Add new Auxiliary Bus with Reflect

  2. Make sure to enable Use game-defined auxiliary sends and enable 2D positioning.
    part_g_2_make_sure_enable_2d_positioning.png

    Make sure to enable 2D positioning

  3. Set Reflect's Max Distance to 10,000 and Speed of Sound to 34,500.
    part_g_2_make_sure_right_speed_of_sound.png

    Make sure to set Reflect's Speed of Sound and Max Distance

  4. Save the project.
  5. In Unreal, from the Wwise Picker, drag and drop the TestSpotReflectorAuxBus into the Content Browser.
  6. Select the PlayReferenceSoundTest AkAmbientSound and set "Enable Spot Reflector" in the "Spatial Audio" section.
    part_g_4_enable_spot_reflector_for_event.png

    Enable spot reflector for Event

  7. Drag a new AkSpotReflector object into the first AkSpatialAudioVolume.
    • Set Location to (x=-150.0, y=-150.0, z=100.0).
  8. On the AkSpotReflector Object, set the option Aux Bus to your "TestSpotReflectorAuxBus".
    part_g_5_drag_new_spot_reflector_for_event.png

    Drag new spot reflector into the scene

  9. Regenerate the SoundBanks.
  10. Start the scene and go inside the volume. You should see the reflection being drawn in the Wwise Reflect - Effect Editor window when triggering the PlayReferenceSoundTest.

Note: If Enable Room is enabled for the AkSpatialAudioVolume, the Auxiliary Bus containing the reverb must have 3D positioning enabled as well.

Generated by  doxygen 1.6.3