The Cover Art
The idea for the visualizer came from some cover art I had made for my EP, Imperative. It started out as a simple sketch, an idea of where I might take this new project. I had not used Processing in such depth before, only having played around with a few examples, so this project also acted as a deeper introduction to the library. From Processing's inherent functionality for movement, and the re-drawing of frames in real-time, came the idea of turning the cover art into something more. A simpler, cleaner concept took form and the code was re-written to allow for the fast re-drawing and responsiveness to audio information.
View the code repository here: github.com/kassianh/imperative_visualizer
The code is freely available, so please feel free to check it out, download, alter, and use it for whatever projects you like. More information is on the repository.
Surrounding Sine Waves
The ground line consists of a sine wave which uses an angle multiplied by the current frame count since the program start to determine the Y position of each X position. It exists as an easy to use function in the code, allowing other parts of the program to check whether they will intersect with the ground.
The extending lines are randomly calculated each time the program restarts. This creates some variation, and balances out the smaller visualizer lines. As you can see, the lower lines are cut off using the ground line function.
Surrounding Sine Waves
The small circles surrounding the center sphere are also calculated using a sinewave, rotating around the circle at varying speeds. The same concept of angle * current frame count applies, except in this case, the distance from the center determines another multiplier and thus its speed.
The visualizer lines are the most complex part of the program. Fast Fourier Transform analysis is used to get numerical values from each frequency band in a small slice of the song. These values are used to determine the distance from the center of each line. Paying closer attention, you might notice that lower audio frequencies are mapped to the center, while higher frequencies are mapped to the sides. A total of 256 frequency bands are mapped to different parts of the 240 degrees of circle (above ground), to create this effect.