The Unity audio systems allow us to access music data via the AudioSource.GetSpectrumData(...) method. This gives us the opportunity to use that data to present a runtime visualization of the overall sound being heard (from the AudioListener) or the individual sound being played by individual AudioSource components.
The following screenshot shows lines drawn using a sample script provided by Unity at https://docs.unity3d.com/ScriptReference/AudioSource.GetSpectrumData.html:
Note that, in the preceding sample code, the use of Debug.DrawLine() only appears in the Scene panel when running the game in the Unity Editor (not for final builds). Therefore, it cannot be seen by the game player. In this recipe, we'll take that same spectral data and use it to create a runtime audio spectral visualization in the Game panel. We'll do this by creating a row of 512 small cubes...