Documentation

Rift Audio

When setting up audio for the Rift, you need to determine whether the Rift headphones are active and pause the audio when your app doesn’t have focus.

The user can enable the Rift headphones and microphone in the Oculus App or use the default Windows audio devices. Configuration is made the Oculus app in Settings -> Devices -> Headset. The following screenshot shows the Rift headphones disabled and the microphone enabled:

Figure 14. Audio Configuration

The headphone setting is handled automatically by the function ovr_GetAudioDeviceOutGuid (located in OVR_CAPI_Audio.h), which returns the GUID for the device to target when playing audio. Similarly, use ovr_GetAudioDeviceInGuid to identify the microphone device used for input.

FMOD

If you detect that the Rift headphones are enabled, use code similar to the following for FMOD:

ERRCHECK(FMOD::System_Create(&sys));
GUIDguid;
ovr_GetAudioDeviceOutGuid(&guid);
 
intdriverCount=0;
sys->getNumDrivers(&driverCount);
 
intdriver=0;
while(driver<driverCount)
{
        charname[256]={0};
        FMOD_GUIDfmodGuid={0};
        sys->getDriverInfo(driver,name,256,&fmodGuid,nullptr,nullptr,nullptr);
 
        if(guid.Data1==fmodGuid.Data1&&
                guid.Data2==fmodGuid.Data2&&
                guid.Data3==fmodGuid.Data3&&
                memcmp(guid.Data4,fmodGuid.Data4,8)==0)
        {
            break;
        }

       ++driver;
}
 
if(driver<driverCount)
{
    sys->setDriver(driver);
}
else
{
// error rift not connected
}

    
   

Wwise

If you detect that the Rift headphones are enabled, use code similar to the following for Wwise:

AkInitSettings initSettings;
AkPlatformInitSettings platformInitSettings;
AK::SoundEngine::GetDefaultInitSettings( initSettings );
AK::SoundEngine::GetDefaultPlatformInitSettings( platformInitSettings );
 
// Configure initSettings and platformInitSettings...
 
WCHAR outStr[128];
if (OVR_SUCCESS(ovr_GetAudioDeviceOutGuidStr(outStr)))
{
    initSettings.eMainOutputType = AkAudioAPI::AkAPI_Wasapi;
    platformInitSettings.idAudioDevice = AK::GetDeviceIDFromName(outStr);
}    

    
   

Unity 5

Audio input and output automatically use the Rift microphone and headphones unless configured to use the Windows default audio device by the user in the Oculus app. Events OVRManager.AudioOutChanged and AudioInChanged occur when audio devices change, making audio playback impossible without a restart.

Unity 5 and Wwise

To configure Wwise to use to configured audio device in Unity 5, pass the user-configured audio device name/GUID (set in the Oculus app) into the function AkSoundEngine.GetDeviceIDFromName(), located in AkInitializer.cs.

To get the audio device GUID from libOVR, you must include the Oculus Utilities unitypackage, which exposes that string through the class OVRManager.

The following function should be called before AkSoundEngine.Init(...):

void SetRiftAudioDevice(AkPlatformInitSettings settings)
{
string audioDevice = OVRManager.audioOutId;
uint audioOutId = AkSoundEngine.GetDeviceIDFromName (audioDevice);
settings.idAudioDevice = audioOutId;
}

Pass AkPlatformInitSettings into the function above and use it to initialize the Ak sound engine.

VR Audio Output in Oculus Store > Settings > Devices > Rift Headset may be used to configure which input mic to use within the Ak sound engine. The GUID for this is exposed through OVRManager.audioInId.

Unity 4

Audio input and output automatically use the Rift microphone and headphones, unless configured to use the Windows default audio device by the user in the Oculus app.

The Rift’s microphone is not used by default when calling Microphone.Start(null,..). Find the entry in Microphone.devices that contains the word Rift and use it.

UE4

When Unreal PC applications are launched, if the OculusRift plugin is enabled and the Oculus VR Runtime Service is installed, then the application will automatically override the default Windows graphics and audio devices and target the Rift. The Oculus VR Runtime Service is installed with the Oculus App.

Unless your application is intended to run in VR, do not enable the OculusRift plugin. Otherwise, it is possible that audio and/or video will be incorrectly targeted to the Oculus Rift when the application is run.

Alternatively, users can disable loading all HMD plugins by specifying "-nohmd" on the command line.

UE4 and Wwise

Use of Wwise with Unreal requires the WwiseUE4Plugin from AudioKinetic’s ‘master’ branch on GitHub. For general information on how to install and use the Wwise Unreal Integration, see Unreal’s documentation on the Installation GitHub site: https://github.com/audiokinetic/WwiseUE4Integration

UE4 and FMOD

For an illustration of how to target the Oculus Rift headphones using FMOD in UE4, see the FMOD section above.

VR Sound Level Best Practices

Audio is an important part of the virtual reality experience, and it is important that all VR apps provide a comfortable listening level for users. Developers should target a reasonable sound level that is consistent between different experiences. To achieve this, Oculus recommends the following best practices.

First, target -18 LUFS during final mix, using tools such as Avid's Pro Limited Plugin, Nugen's VisLM, Klangfreund LUFS Meter, Audacity VuMeter, or similar loudness measurement tools.

Second, measure your experience against the audio levels in published Oculus experiences, especially the ambient audio in Home and the Dreamdeck experience. Set overall system volume so that Dreamdeck and Home sound comfortable, and then adjust your experience's mix to this volume.

Finally, mix your application using the Rift headphones. This ensures that the sounds you're creating and mixing have a frequency content appropriate for the headphones most Oculus users will use.

By adhering to these guidelines, we can guarantee that our Oculus VR users will have a pleasant audio experience.

Loading…