Spatial audio with ExoPlayer and GVR

Andrew Lewis
Mar 2, 2017 · 2 min read

Virtual reality applications rely on realistic audio rendering to create and maintain the illusion of being in another world. This post describes how to use ExoPlayer’s new GVR extension, which makes it easy to render spatial audio in VR applications.

The Google VR SDK documentation has a great introduction to how spatial audio works and is worth reading as an overview.

The ExoPlayer GVR extension provides GvrAudioProcessor, which wraps GvrAudioSurround from the Google VR SDK. This audio processor renders spatial audio to stereo, handling both standard multichannel audio streams and ambisonic soundfields as input.

The extension will be included in the upcoming ExoPlayer 2.3 release, but until then you can try it out on the dev-v2 branch. If you’re using SimpleExoPlayer, override buildAudioProcessors in the RenderersFactory:

If you’re constructing renderers directly, you can pass a GvrAudioProcessor to your audio renderer’s constructor.

To give an immersive experience it’s necessary to account for changes in the user’s head orientation. This is achieved by calling updateOrientation, passing in a quaternion specifying the current rotation. For example, if you’re implementing a GvrView.Renderer or StereoRenderer, you can update the orientation in onDrawFrame or onNewFrame respectively:

For information on supported ambisonic soundfield formats, consult the documentation on GvrAudioSurround.SurroundFormat.

We hope that the new spatial audio rendering extension makes it easy to add spatial audio support in your application. Please let us know how you get on in the comments below and report any issues on our issue tracker. The Google VR SDK has its own issue tracker for any VR-specific issues. We look forward to extending the ExoPlayer GVR extension with new functionality in the future.


The ExoPlayer developer blog

Thanks to Olly Woodman

Andrew Lewis

Written by


The ExoPlayer developer blog

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade