Meta XR Audio Plugin for Unreal Tutorial
The section will be a brief tutorial on setting up a simple Unreal Project to exercise the features of the Meta XR Audio Plugin.
Create a new Unreal project Open Unreal Engine and on the New Project page click Games > First Person as the type to provide us with a template project to work with.
In our demo, we will have one source, so navigate to the Content Browser, right-click and then select Sound > Sound Cue. Rename the event to something we can remember and reuse, in this case we will select Starter_Music_Cue. Next in the Content Browser we must add a .wav file that the Sound Cue can play back. Choose a .wav file from your file explore and drag and drop it into the Content Browser. Next double click the Sound Cue and select the wav file that was just added as the audio source.
Now the Sound Cue will make play back the wav file, but it will not be spatialized. To tell Unreal to spatialize this source, the Sound Attenuation asset is utilized. Right click in the Content Browser and select Sounds > Sound Attenuation to create a new asset. Double click the Sound Attenuation asset to open its settings and change the Attenuation (Spatialization)’s Spatialization Method setting to Binaural.
Now this asset can be attached to the Sound Cue by entering the Sound Cue’s settings under Attenuation > Attenuation Settings and selecting the Sound Attenuation asset that was just created.
Now drag and drop the Sound Cue from the Content Browser into the game. When you enter play mode, the sound should appear to come from the location you placed it in the game.
Hit play in Unreal and move around to listen to the spatialization in action.
Next we can make our audio more realistic by adding reflections to the audio. This is done by creating a single reverb submix effect and routing all the spatialized sound cues through that submix.
Create a new Sound Submix by right clicking in the Content Browser and selecting Audio > Mix > Sound Submix. Then route your Sound Cue into this submix by double clicking the Sound Cue and under Effects > Submix set the “Base Submix” to the Sound Submix.
Add the reverb effect to the submix Now the Sound Cue is routed through the Submix, but still no reverb is produced. In order to tell the plugin to generate reverb, a Submix Effect Preset has to be added to the submix.
Create a new Sound Submix Effect Preset by right clicking in the Content Browser and selecting Audio > Effects > Submix Effect Preset and choosing the SubmixEffectMetaXRReverbPluginPreset option. Attach the MetaXRReverb effect preset to the Sound Submix.
Return to the Unreal Project and hit play to hear how it sounds with the reverb added. From here you may want to gain additional control over how the reverb sounds. Head to the unreal project and find the level heirarchy. Right click to add a new component of Meta XR Audio Room. We will use this object to represent our game’s overall geometric properties. Now start the game again and change these controls in real time to hear how they impact the reverb’s sound.
Adjusting source settings
Each source spatializer instance has a few additional settings to help customize the sound for each event. To gain access to these controls the Meta XR Audio Source Settings asset is used. Create a new “Meta XR Audio Source Settings” by right clicking in the component browser and selecting Sounds > Meta > Meta XR Audio Source Settings. This asset has to be attached to a Sound Attenuation asset by double clicking the Sound Attenuation asset to open its settings. Attach the Source Settings to the Sound Attenuation object by clicking the plus next to Spatialization Plugin Settings and selecting the Meta XR Audio Source Settings asset.
To display one of these, check out the MetaXRAudio Source plugin for our myEvent and find the Source Directivity control. By default it is None but for this demo change it to Human Voice. Now play the game again and hear how the sound filters as you move around the source sphere.
To demonstrate how ambisonics work in the MetaXRAudio SDK, we will now add an ambisonic bed into our project. Find an ambisonic file in your file browser and drag and drop it onto the Content Browser. Double click the file to go to its settings and nsure that ambisonics are enabled for this file as shown below:
In order to render ambisonic files binarually, the ambisonic file has to be routed into a Soundfield Submix. This is Unreal’s container type for ambisonic processing. To do so, right click in the content browser and click Sounds > Mix > Soundfield Submix. Create a new Sound Cue for the ambisonic file just like the mono file from above and select the ambisonic file as the source. Then double the Sound Cue and under Submix > Base Submix, select the Soundfield Submix that was just created.
Finally, it is necessary to specify to Unreal that the Meta XR Audio SDK should be used for ambisonic encoding on the submix. If you don’t specify this, it is likely it will by default expect to use the built-in Unreal encoder. To change it, double click the Soundfield Submix created in step 1. Set the Soundfield > Soundfield Encoding Format to MetaXR Binaural.
Return to the Unreal project and hit play. Listen to the ambisonics being rendered and take note of how it will rotate as you move about the scene.
That concludes our tutorial building a real project using the Meta XR Audio Plugin for Unreal. You should now be able to quickly spatialize any new events you add to your game as well as alter the room acoustics for the project.