Skip to content

Latest commit

 

History

History
92 lines (56 loc) · 5.67 KB

unity-spatial-audio-ch1.md

File metadata and controls

92 lines (56 loc) · 5.67 KB
title description author ms.author ms.date ms.topic keywords
Spatial audio tutorials - 1. Adding spatial audio to your project
Add the Microsoft Spatializer plugin to your Unity project to access HoloLens 2 HRTF hardware offload.
kegodin
v-hferrone
02/05/2021
article
mixed reality, unity, tutorial, hololens2, spatial audio, MRTK, mixed reality toolkit, UWP, Windows 10, HRTF, head-related transfer function, reverb, Microsoft Spatializer

1. Adding Spatial audio to your Unity project

Overview

Welcome to the spatial audio tutorial for Unity on HoloLens2. Through this tutorial series, you will learn how to use head-related transfer function (HRTF) offload on HoloLens 2 and How to enable reverb when using HRTF offload.

The Microsoft Spatializer GitHub repository has a completed Unity project of this tutorial sequence.

For an understanding of what it means to spatialize sounds using HRTF-based spatialization technologies and recommendations for when it can be helpful, see spatial sound design.

What is HRTF offload?

Processing audio using HRTF-based algorithms requires a large amount of specialized computation. HoloLens 2 includes dedicated hardware that can be utilized to avoid burdening the application processor, thus "offloading" the processing of HRTF-based algorithms. The Microsoft spatializer plugin provides an easy way for your application to take advantage of the dedicated HRTF hardware so your application can use more of the application processor for operations other than spatial audio.

Objectives

  • Importing and Enabling Microsoft spatializer plugin
  • Enabling Spatial audio on your developer workstation

Prerequisites

We strongly recommend completing the Getting started tutorials series or having some basic prior experience with Unity and MRTK before continuing.

Important

  • The recommended Unity version for this tutorial series is Unity 2019 LTS. It supersedes any Unity version requirements or recommendations stated in the prerequisites linked above.

Creating and preparing the Unity project

In this section, you will create a new Unity project and get it ready for MRTK development.

For this, first follow the Initializing your project and first application, excluding the Build your application to your device instructions, which includes the following steps:

  1. Creating the Unity project and give it a suitable name, for example, MRTK Tutorials

  2. Switching the build platform

  3. Importing the TextMeshPro Essential Resources

  4. Importing the Mixed Reality Toolkit

  5. Configuring the Unity project

  6. Creating and setting the scene and give the scene a suitable name, for example, SpatialAudio

Then follow the Changing the Spatial Awareness Display Option instructions to ensure the MRTK configuration profile for your scene is DefaultHoloLens2ConfigurationProfile and change the display options for the spatial awareness mesh to Occlusion.

Adding Microsoft Spatializer to the Project

Download and import the Microsoft Spatializer Microsoft.SpatialAudio.Spatializer.Unity.1.0.18.unitypackage

Tip

 For a reminder on how to import a Unity custom package, you can refer to the Importing the tutorial assets instructions.

Enable the Microsoft Spatializer plugin

After importing the Microsoft Spatializer you need to enable it. Open Edit -> Project Settings -> Audio, and change Spatializer Plugin to "Microsoft Spatializer".

Project Settings showing spatializer plugin

Enable spatial audio on your workstation

On desktop versions of Windows, spatial audio is disabled by default. Enable it by right-clicking on the volume icon in the task bar. To get the best representation of what you'll hear on HoloLens 2, choose Spatial sound -> Windows Sonic for Headphones.

Desktop spatial audio settings

Note

This setting is only required if you plan to test your project in the Unity editor.

Congratulations

In this tutorial you have learnt how to Import and enable the Microsoft Spatializer plugin and also to enable the spatial audio on your workstation. In the next tutorial you will learn how to add spatial audio in the unity project.

[!div class="nextstepaction"] Next Tutorial: 2. Spatializing button interaction sounds