Skip to content
Flat 5% off if you buy 5 or more of the same product. Shop now! | Join our telegram channel, hit this bar.
Flat 5% off if you buy 5 or more of the same product. Shop now! | Join our telegram channel, hit this bar.
Arduino Spectrum Visualizer

Arduino Spectrum Visualizer

A music visualizer works by extracting waveform and/or frequency information from the music and feeding this information through some display rules, which produces what you see on the screen.

The rules are predefined by the programmer, but the actual output will depend on the unique waveform and frequency characteristics of the audio.

The visualizer software starts by analysing the waveform and frequency information in the audio.

The waveform is a series of numbers representing the loudness of the sound at moments in time. The waveform level is loosely related the beat of the music. The loudness values are typically higher during a beat.

The frequency information describes the levels of various pitches within the audio signal at moments in time. A technique called Fourier transform extracts frequency information from the waveform. The frequency information is loosely related to the notes of the music, but may not correspond to actual musical notes. It does provide information about distribution of high and low pitches at moments in time.

The range of the visualizer is 280Hz to 19 kHz. It is a 32 band audio frequency visualizer.  The device is capable of displaying the frequencies of the audio signal, which can be used for both entertainment or studying the audio signal.

The left and right channels of the audio would be mixed for input.

The Arduino board contains a multichannel 10 bit ADC (Analog to Digital Convertor). The ADC is configured so as to sample the input analog signal with clock signal 38.46 kHz. Consider the clock frequency as d. The ADC pre-scalar is configured to 32.

According to Nyquist theorem; in order to adequately reproduce a signal it should be periodically sampled at the rate that is twice the highest frequency that is to be recorded.

  • f = d/2
  • f = 38.46/2 = 19.23 kHz

We configure the ADC to use the 3.3v from the board as reference voltage.

The ADC cycle doesn’t consider the negative cycles of the input as analog signal oscillates above the zero voltage level.

The FFT library does most of the work in this code. Fast Fourier Transform (aka. FFT) is an algorithm that computes Discrete Fourier Transform (DFT). The main principle here is that any signal (even non-periodic ones) can be quite accurately reconstructed by adding sinusoidal signals together with different frequencies and amplitudes. The more sinusoidal signals we add together, the more our reconstructed signal will look like the original one. Theoretically speaking, with an infinite amount of sinusoidal signals we get an identical signal as the original.

The range of samples we can take is between 16 and 128. Also, the greater the number of samples the more accurate the result is BUT the computation time increases. Henceforth, 64 samples will be considered. Once the 64 samples are taken, the Arduino performs FFT on them.


Components required:

  1. Arduino board
  2. 32*8 LED matrix
  3. Jumper wires / Connecting wires
  4. 3.5mm Audio Jack
  5. 100k ohm and 4.7k ohm resistor
  6. 0.1 uf capacitor ( x2)
  7. Breadboard

I have used an Arduino Nano in this project, feel free to use whichever board available.

( or 4 x 8*8 LED matrices; just make sure you align the matrices in a proper order)


The point closest to the screw type part is the ground pin, the other two are the left and right channels. We would need to mix the two channels for sampling.



Find the code in our GitHub Repo


Author: Moksh Deepak Jadhav

Next article Raspberry Pi VS Arduino

Leave a comment

* Required fields

Welcome Newcomer