Audio Visualizer — Code (Fourier Transform)

Having previously used Fourier Series and Transforms in our signals and systems, and differential equations courses, we knew that we could find frequency data from a time domain signal. The challenge really came in trying to determine the best way to implement our understanding. On paper and by hand, Fourier Series and Transforms can be pretty time and calculation intensive. Also, because we’d be performing our calculations on a microcontroller, we had to shift our focus to Discrete Fourier Transforms, and then because of our near real time goal and limited processing power, we had to consider the algorithmic Fast Fourier Transform (FFT). With all this in mind, we knew that someone else had probably already solved this problem. After some research about implementation of FFT on Arduino (https://www.norwegiancreations.com/2017/08/what-is-fft-and-how-can-you-implement-it-on-an-arduino/) and some quick Google searches for AVR FFT, we stumbled upon an efficient, flexible, and open-source FFT written in Assembly (http://elm-chan.org/works/akilcd/report_e.html). Fortunately, the open-source code by ©ChaN was easily integrated into our project with Atmel Studio. Furthermore, the source files were well commented and were added to our project with great ease. Using the guidance of the comments in the Assembly FFT and the basic outline of the Arduino implementation, we were able to successfully sample and transform a signal into the frequency domain in near realtime.