As most people do, I enjoy listening to music at any opportunity I get. Since I listen to music so often, I decided to make a project that combined music and engineering.
I decided to make an audio visualizer. What this device does is monitor a sound signal and, depending on the frequency and tone of a sound, produce different colored pulses on a scrolling LED strip.
It is hard to capture the effect of the visualizer with a video, but a sample of the output can be seen in the video on the right.
Since I had full control over the system, I decided early on which controls I would like the user to have access to. I decided to keep it simple, but very customizable.
The control panel consists of four buttons and seven potentiometers. The granular control comes from the six potentiometers on the sides of the panel. Each set of three dials controls the red, green, and blue components of the colors displayed by the LEDs. Since there is a color for 'highs' and 'lows' in a song, the user has full control over the colors displayed.
The simplicity comes from the four buttons in the middle. The top two buttons are used for default color combinations. If the user pushed either of these buttons, the colors for the highs and lows are set to a predetermined value and no more input is needed. There is a set of blue hue colors and red hue colors.
Below the color set buttons are two numbered buttons. These switch the mode the LEDs operate in. Depending on the need of the user, the LEDs can either display the visualized audio signal, or turn a sold color. These two buttons control that functionality.
The lid of the enclosure is held in place by magnets surrounding the edge of the case (see the image below). Within the case lies the electronics and any cables that are needed for the unit to operate. The layout of the buttons and potentiometers were decided on practicality, size, and ease of use. The enclosure was 3D printed.
The brains of the electronic system is an Arduino Mega. The Mega was chosen because it has considerable computation power for a micro-controller, was compatible with the utilized shield (see below), cheap, and I was familiar with the process of using such a board.
I considered the proper method of audio analysis for some time. I decided to opt with a SparkFun Spectrum Shield rather than preforming a fast Fourier transform (FFT) as it would allow for quicker user interaction and LED control. This setup worked very well and required minimal setup or calibration to use.
The LEDs selected were WS2812 type diodes (commonly known as NeoPixels) on a flexible, waterproof strip. This style of LED is controlled by a single data pin which was eventually a shortcoming of the design. See the Final Product section below for more information.
The software portion of this project consumed the majority of the time.
The program does several things to ensure a nice user experience:
Calculate LED positions for pulses sent down the strip
Dynamically set LED trigger thresholds to account for volume and frequency changes
Monitor user IO
Control LEDs with no input from user
Pull data from the Spectrum Shield
Operate at speeds not distracting to the user
Considering all of these requirements, the software development took many hours of creation and rigorous testing. The final product meet all goals well, but was not expandable due to a limitation by the LEDs. See the Final Product section below for more information.
The final product preforms extremely well. It adapts to all volumes, tempos, genres, etc. of music and produces a pleasant light show to watch while listening to music.
As mentioned above, the final design was limited by the LEDs. Since WS2812 LEDs are controlled by a single data wire, they operate at a set frequency. What this means is that adding another strip at the end of the first strip slows the system down too much. Since the LEDs must be set one at a time, and can be communicated with at a set frequency, when adding another strip to total 600 LEDs, the output looked choppy and unacceptable. For this reason, the system is limited to around 300 LEDs. This is good for single room use, but would need to be revisited if expanded for larger sets of LEDs.