Now that we have seen the completed demo, let's see how this all works under the covers by following the instructions:
- Open up Unity and locate the VisualizeSoundManager script in the Project window and double-click on the script to open it in your preferred editor. Unlike previous chapters, we are not going to look at the entire script but just look at the highlights.
- Start by scrolling down to the Start method, as shown here:
void Start () { audioSource = GetComponent<AudioSource>(); samples = new float[sampleNo]; CreateFrequencyBins(); }
- The Start method should be very familiar to you by now. First, we get the audioSource component, initialize an array called samples, and finally call the method CreateFrequencyBins ...