Audio Visualization Tutorial [Unity C#] Q&A

This is the official thread for discussion, issues and Q&A for the Audio Visualization tutorial.

I have been working hard on creating an extensive video tutorial series on how to create your own Audio Visualizer in Unity C#.

Learn how to code your own music visualizer using c#.
In these series you will learn how to:

  • Use Fast Fourier Transform (FFT)
  • Visualize music into gameobjects
  • Scripting buffers for visualisation
  • Applying scripts to models, lights, transforms, camera, and shaders.

If you have any questions, or additions to this tutorial, feel free to reply. I'm hoping you will find this tutorial helpful.
I haven't seen an extensive tutorial on this subject yet, so I decided to share my knowledge for free, so that you all may learn, and create more awesome stuff!
To support me creating free tutorials on audio, visuals, algorithms & shaders in Unity, consider supporting me on Patreon. http://www.patreon.com/peerplay
Source files download: http://www.peerplay.nl/tutorials/peerplay-AudioVisTutPart1-source.zip

Part 0 - Result


Part 1 - FFT/Spectrum Theory

Part 2 - GetSpectrumData in Unity

Part 3 - Visualize 512 samples

Part 4 - Eight Frequency Bands

Part 5 - Adding Buffers
https://www.youtube.com/watch?v=lEUuC3LQnzs (click link for video)

Part 6 - Ranged Usable Values
https://www.youtube.com/watch?v=QJCipD3YEE8 (click link for video)

Part 7 - Get Average Amplitude
https://youtu.be/EAjNZJ8G0Hs
Part 10 - 64 Audio Bands
https://youtu.be/l77pAKrKe5s

8 Likes

In part 3 (at 3 minutes and 10 seconds), how did you get the parametric cube prefab option to pop-up when selecting a sample cube prefab? Do we make the cube on our own?

Downloadlink to the source files, including the parametric cube prefab: http://www.peerplay.nl/tutorials/peerplay-AudioVisTutPart1-source.zip

1 Like

There is no valid source code where you say. The C# Script is where? On a pay for a post site? Correct me if I am wrong.

2 Likes

Download what valid source from one month ago?

Really great stuff! Does this works in realtime?

Yes it does! It takes the frequency bins from the audio you are playing in real time.

If I wanted to use this for a live performance, what would I put inside AudioSource as the AudioClip?

This is an awesome tutorial. I am pretty new to Unity, so i am just learning stuff. I just have the following questions.

Why do you convert them into 8 bands only? Why not more? Wouldn't having less frequency range for each band result in more number of bands and thus be more accurate?

no me muestra la luz de los cubos como esta en Part 5 - Adding Buffers como hago ese efecto de brillo

In part one I am having issues with unity recognizing RequireComponent and AudioSource. I have the most up to date version I'm not sure what I need in my code to get unity to understand that even tho I am following unity's API. Should i just keep coding and hope that it works? It seems to me that I will get a compile error.

Good explanation about FFT theory, thanks . If someone search about Preprocessing method - here is good article, detects beat pretty precise. https://medium.com/giant-scam/algorithmic-beat-mapping-in-unity-preprocessed-audio-analysis-d41c339c135a