cancel
Showing results for 
Search instead for 
Did you mean: 

[UE4] Sound spatialization solutions for Quest/Go ?!

motorsep
Rising Star
@NinjaGG

The rumor has it that the native Oculus spatializer for UE4 is broken beyond belief and the fix is at the bottom of the priorities list.

What should I use to have spatialized audio on Go / Quest when using UE 4.22.3 or upcoming 4.23 with Oculus integrations (from Oculus github) ? 

Thanks
18 REPLIES 18

motorsep
Rising Star

hcenteno said:

And there's also the libraries included here: https://developer.oculus.com/downloads/package/oculus-spatializer-native/
Which might also work (?)


Have you tried compiling UE 4.23 project from Oculus github with those? (per project, or with the engine itself)

virtualHCG
Expert Protege

hcenteno said:

And there's also the libraries included here: https://developer.oculus.com/downloads/package/oculus-spatializer-native/
Which might also work (?)


Actually I just ran a diff between OVRAudio.h present in the Unreal Engine source and the one distributed with the native Audio SDK package and they are basically the same, except for the version number. So that's good news. I'll look more into it, hopefully it's not a waste of time.

virtualHCG
Expert Protege

motorsep said:


hcenteno said:

And there's also the libraries included here: https://developer.oculus.com/downloads/package/oculus-spatializer-native/
Which might also work (?)


Have you tried compiling UE 4.23 project from Oculus github with those? (per project, or with the engine itself)


Yes, I just tried and it fails. There's a function called ovrAudio_GetPluginContext that is not present in the libraries distributed with the AudioSDK so building fails due to this. That function is present in the Unity library so I'm guessing the library they distribute for Unity is a special build (plugin build?) and the function is not used for the native SDK. On the other hand, it's probably possible to get the native library to work with Unreal Engine but it might require more development than what I can do right now. I'll keep digging, though.

virtualHCG
Expert Protege
Well, the good news is that after a couple of days of going over the Oculus Audio plugin code and making some changes, I managed to get it running on the Quest. The reverb and early reflections seem to work too. I wonder why Oculus hasn't finished the implementation for Android when there's actually not that much left to do.

I did find a comment in OculusAudio.h that reads: 
//HACK: disabling Android platform here, because OculusAudio platform does not support android in 4.22.

I wonder what was the problem with 4.22 (I got it working using 4.23).

motorsep
Rising Star

hcenteno said:


I wonder what was the problem with 4.22 (I got it working using 4.23).



Care to share how to get Oculus Audio (with reverb and reflections) working for Quest using Oculus UE 4.23.1 fork ?

virtualHCG
Expert Protege
Here it is. I share this "as is" and with the warning that I haven't tested it extensively and it's more of a hack than a proper solution, but at least with one audio source placed in the scene, I got both reverb and spatialization working. Also make sure your audio sources are mono since anything more than one channel disables the plugin for that source and reverts to internal spatialization. After making these changes and rebuilding the engine, now Oculus Audio can be selected under the Audio settings of the Android platform in the project settings, both as spatialization and reverb plugin. The rest should be the same as when setting up Oculus Audio for audio soruces (create an Oculus Audio Source Settings asset, add it to the source, set spatialization to binaural and set "Enable Volume Attenuation" to false in the source's details if "Attenuation Enabled" is set to true in the Oculus Audio settings asset).

In UnrealEngine\Engine\Plugins\Runtime\Oculus\OculusAudio\OculusAudio.uplugin add Android to the whitelist:
"Modules": [
{
"Name": "OculusAudio",
"Type": "Runtime",
"LoadingPhase": "PostConfigInit",
"WhitelistPlatforms": [
"Win64",
"Android"
]
},
In UnrealEngine\Engine\Plugins\Runtime\Oculus\OculusAudio\Source\OculusAudio\Private\OculusAudio.h add Android to the if statement (line 30):
//HACK: disabling Android platform here, because OculusAudio platform does not support android in 4.22.
if (Platform == EAudioPlatform::Windows || Platform == EAudioPlatform::Android)
{
And in the same file, also add Android to the if statement (line 62):
virtual bool SupportsPlatform(EAudioPlatform Platform) override
{
if (Platform == EAudioPlatform::Windows || Platform == EAudioPlatform::Android)
{
At line 166 of UnrealEngine\Engine\Plugins\Runtime\Oculus\OculusAudio\Source\OculusAudio\Private\OculusAudioDllManager.cpp add this:
#if PLATFORM_ANDROID
ovrResult ovrAudio_GetPluginContext(ovrAudioContext* context, unsigned clientType)
{

return 0;
}
#endif
In the same fie, right below the previous, in the GetPluginContext() surround the FMod section with a platform conditional preprocessor (it seems that more needs to be done to get FMod working):
#if PLATFORM_WINDOWS
// FMOD plugin needs to know about the unit scale
auto SetFMODUnitScale = OVRA_CALL(OSP_FMOD_SetUnitScale);
if (SetFMODUnitScale != nullptr)
{
Result = SetFMODUnitScale(0.01f);
check(Result == ovrSuccess);
}
#endif




virtualHCG
Expert Protege
Four days ago there was a commit done to the Oculus UE4 GitHub repo (4.23) that upgraded the VR and Audio SDKs, including Android support for Oculus Audio. This means the previously posted changes are not needed anymore! Official support is finally here. Thanks!

motorsep
Rising Star

hcenteno said:

Four days ago there was a commit done to the Oculus UE4 GitHub repo (4.23) that upgraded the VR and Audio SDKs, including Android support for Oculus Audio. This means the previously posted changes are not needed anymore! Official support is finally here. Thanks!



Are you saying now we can build 64bit Android for Quest and have native spatialization/reverb/reflections/etc. simply using UE4 without any additional 3rd party plugins (besides Oculus Audio) ?

virtualHCG
Expert Protege

motorsep said:


hcenteno said:

Four days ago there was a commit done to the Oculus UE4 GitHub repo (4.23) that upgraded the VR and Audio SDKs, including Android support for Oculus Audio. This means the previously posted changes are not needed anymore! Official support is finally here. Thanks!



Are you saying now we can build 64bit Android for Quest and have native spatialization/reverb/reflections/etc. simply using UE4 without any additional 3rd party plugins (besides Oculus Audio) ?
Yes, that seems to be the case. I haven't tested reflections and reverb but spatialization works and from what I see the other should too. They did add 64bit binaries too so 64bit builds seem possible now