Summary

In this chapter, we built a music visualizer that runs as a Cardboard VR application. We designed a general architecture that lets you define multiple visualizations, plug them into the app, and transition between them. The app uses the Android Visualization API to capture the waveform and FFT data from the phone's current audio player.

First, we defined the VisualizerBox class responsible for the activity and callback functions to the Android Visualizer API. Then, we defined an abstract Visualization class to implement a variety of visualizations. We then added waveform audio data capture to VisualizerBox and used it to parametrically animate a series of cubes to make a 3D wavy box. Next, we wrote a second visualizer; this time using waveform data to dynamically generate a texture that is rendered with material shader programs. And lastly, we captured the FFT audio data and used it for a third visualization. Then, we added more fun with a trippy trails mode and multiple concurrent visualizations that transition in and out randomly.

We acknowledge that the visual examples are pretty simplistic, but hopefully they'll fuel your imagination. We challenge you to build your own 3D virtual reality music visualizations that perhaps utilize a combination of the techniques in this project as well as other things from this book.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset