This project was an exciting introduction to the world of audio visualization within Unity 3D. Using the built-in fast fourier transform function to gather sample data, this audio visualizer simulates Koch fractals and trails which respond to the music being played in real time.
Essentially, Koch fractals are generated by continuously adding a certain pattern to each face of a given shape. The initiator shape can be any two dimensional shape and the pattern can be any sort of line segment. This project uses Unity’s line renderer to generate the shapes according to the parameters assigned in the inspector. Parameters include the initiator shape itself, the generation patter, the number of generations, whether to use bezier curves, and more.
The trail patters follow these predefined Koch fractal shapes, and the inspector can control their color, length, width, and speed. These allow for some very mesmerizing visual displays. Any of these parameters can be manipulated thanks to the audio visualization script. For example, the height (magnitude) of a particular fractal generation can be controlled by any of eight different audio frequency ranging from bass to treble. Even the overall volume or amplitude of the track can be used as a controlling variable.
This was a particularly exciting crash course on Unity’s audio visualization capabilities, made possibly by the following tutorials:
Koch Fractals: https://www.youtube.com/watch?v=fkRnUoXacHM&list=PL3POsQzaCw53vmvWr-Ye-R0d3NPJzp25P
Audio Peer: https://www.youtube.com/watch?v=4Av788P9stk&t=10s