Unreal Spatial Audio

Unreal Engine Plugin 

Overview 

The included Unreal Engine Plugin enables developers to utilize the HP VR Spatial Audio framework inside the Unreal Engine 

Adding the plugin to your project 

In your UE4 project’s directory create a new directory called “Plugins” and copy the “HPVRSpatialAudio” folder corresponding to the version of UE4 your project is being developed in. The default install location is  C:\Program Files\HP\HP VR Spatial Audio\UE4\{UE4_version}\ HPVRSpatialAudio 

Setting up HPVRSpatialAudio requires adding debugging arguments to the project in Visual Studio. If your project is a Blueprint project you will need to create a new C++ class so that Unreal will generate a Visual Studio solution for you. 

After copying the plugin folder, right click on your .uproject file and select “Generate Visual Studio project files” 

Open the generated Visual Studio solution file for your project and you should see the “Plugins” folder with the “HPVRSpatialAudio.uplugin” in it. 

 

 

You will need to add “--audiomixer” to the “Command Arguments” for your project. Right click on your project in the “Solution Explorer”, and select “Properties” in the menu to open the “Properties Page” for your project. In the “Property Page”, click “Debugging”, then click on “Command Arguments” and append “-audiomixer” to it,  

 

Setup 

From the Ue4 editor you can add the HPVRSpatialAudio plugin to your project by going to the Project Settings, and in the “Audio” section of “Platform - Windows” click the drop-down menu for “Spatialization Plugin” and select “HP VR Spatial Audio” 

 

 

 

Usage 

“HP VR Spatial Audio” needs to be explicitly enabled by an object in your game. This is done by calling the “Asynchronously Enable Spatial Audio” function in a Blueprint with your license information. This function only needs to be called one time successfully during the game, it will remain active after. “HP VR Spatial Audio”, once enabled, will remain enabled for the lifetime of the process.  

 

 

The enablement call will happen asynchronously to avoid blocking game threads while the license checkout is happening. The Blueprint function "Get Enable Spatial Audio Result” will return the current status of the license checkout. 

 

 

Adding HP VR Spatial Audio to an Actor 

 

To use “HP VR Spatial Audio” create an “Audio” component to an object. Scroll to the “Attenuation” section in the “Details” pane of the “Audio” component and create a new “Sound Attenuation” asset 

 

 

Double click on the new sound attenuation asset to open up the editor for it, and chance the “Spatialization Method” to “Binaural”  

 

Then click the “+” by “Spatialization Plugin Settings” and create a new “HP VR Spatial Audio Source Settings” asset  

Double click on the newly created “HP VR Spatial Audio Source Settings” to edit the Spatialization Parameters. 

 

Params: 

  • HRTFAngle: The minimum change in angle (degrees) between an Audio Source and listener before recalculating HRTF (Default:1.0, Range:0.0 - 10.0) 

  • Spatial Blend: Sets how much this AudioSource is treated as a 3D source. 3D sources are affected by spatial position and spread. If 3D Pan Level is 0, all spatial attenuation is ignored.  (Range: 0.0 - 1.0 ) 

  • Spread: Sets the spread of a 3D sound in speaker space. (Range: 0 – 360) 

  • Stereo Pan: Only valid for Mono and Stereo AudioClips. Mono sounds will be panned at constant power left and right. Stereo sounds will have each left/right value faded up and down according to the specified pan value. (Range: -1.0, 1.0) 

 

Caveats: 

 

  • Once HP VR Spatial Audio enabled, the license will be checked out for the lifetime of the process, if you are running in the editor you will need to close it to check the license back in. 

Enable Result 

Spatial Audio enablement happens asynchronously, if you want the result of the call, HPVRSpatialAudioEnabler provides enablement results through the function getEnableResult. Each result has a status enum and a message. The statuses are: 

  • Not Started: No call has been made to enable spatial audio. 

  • In Progress: The call to enable spatial audio is currently in progress. 

  • Enabled: HP VR Spatial Audio has been enabled.  

  • Failed: HP VR Spatial Audio failed to be enabled. Check the message string for a more detailed explanation.