Get Spectrum Data Helper is a Unity project with some scripts and example that allow you to create audio visuals in unity.
The main script is GetSpectrumDataHelper.cs and takes an audio source and returns an array of 128 values corresponding to the amplitude of frequencies on a classical piano (and a few notes above and below that range). This makes it such that you can have musical frequency values of any audio file drive anything you can connect to it through scripts in unity.
It uses unity’s native function AudioListener.GetSpectrumData. This function is great, but the data it returns does not intuitively correlate to the frequencies we associate with musical notes but with GetSpectrumData you can do so and also learn how to do so because it is commented in detail. There are a number of things that make AudioListener.GetSpectrumData not so easy to use right out of the box in a musical way, which is a shame cause there is so much you could do with it, so that’s what GetSpectrumDataHelper.cs is for.
There is also a function called SoundTexture.cs which in conjunction with GetSpectrumDataHelper.cs puts the musical data into a 128×1 pixel dynamic texture so that you can send that data into shaders and have music affect your materials by getting creative with shader graphs.