For the next visualization, we'll introduce the use of FFT data (instead of waveform data). As in the previous example, we'll dynamically generate a texture from the data and write a material and shaders to render it.
Capture the FFT audio data
To begin with, we need to add that data capture to our
VisualizerBox class. We will start by adding the variables we'll need:
public static byte fftBytes, fftNorm; public static float fftPrep; public static int fftTexture = -1;
We need to allocate the FFT data arrays, and to do that we need to know their size. We can ask the Android
Visualizer API how much data it's capable of giving us. For now, we'll choose the minimum size and then allocate the arrays as follows:
public VisualizerBox(final ...