Web Audio Concepts
The Web Audio API is a powerful, high-performance way of manipulating sound in the browser. Before continuing this tutorial, you might want to check out the previous blog posts.
– Part 1: Overview of the Spaceport Volumetric Video Capturing and Streaming
– Part 2: Spaceport Volumetric Video Container Structure
– Part 4: Spaceport 1.0
– Part 5: WebAR and integration to 8th Wall
In this tutorial, We’ll show you how to add sound to the volumetric video, in a good way.
Step 1: Configure your index.html
To add audio to your volumetric player, create a new audio tag. WEB audio API provides a convenient audio tool to set up your audio source and get your background audio configured quickly. You can choose from a few different methods, but in our case, we’re keeping it simple with the audio tag.
Step 2: Loading sounds
Step 3: Playing Sounds
Once one or more AudioBuffers are loaded, then we’re ready to play sounds. Let’s assume we’ve just loaded an AudioBuffer with the sound of a dog barking and that the loading has finished. Then we can play this buffer with the following code.
In this article, we learned more about the Web Audio API and how this API can help us work with audio in the volumetric video player. It opens a lot of possibilities for us to create more complex applications.
Hope you enjoyed the blog post. If you have any questions please do not hesitate to contact us.