SpectraVUlizer- Lights,Music and Magic

Doo Things, Pune, India

One day while chatting with my good friend Rituparna we stumbled upon building a sound reactive light for Ritu’s Ritz Car. Amplitude based light would be too stale for his taste and we needed something that was more dhinchaak. So why not visualize music in the frequency domain as well. So, as the sound changes bands we could change the color of his car’s interiors.

Hence we would certainly have to do some FFT so we have an idea of the relative amplitude of sound in different bands and then use the Neo Pixel strips to visualize the pattern. We planned to use the Tah as our number cruncher of choice.

One fine afternoon we met at doo Things to get the project up and running. We decided to use the MSGEQ7 which is a Seven Band Graphic Equalizer and produces analog voltages of the value of signal in a particular band. Its not difficult to interface and would help us update the strip real-time which could be difficult with software FFTs. Also it was directly capable of receiving signal from the standard 3.5mm line saving us with effort to make an amplifier if we used the standard FFT libraries. Reading it is similar to how you read a shift register.

We followed the standard circuit from the datasheet and programmed the Tah to read the signal and reflect the same on the neo-pixels. The whole circuit was built on a perfboard and powered by a standard 5V Adapter.



The test code we used is as follows:

Released under MIT License
A project by Rituparna and Rohit

#include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel strip = Adafruit_NeoPixel(144, NEOPIXELPIN, NEO_GRB + NEO_KHZ800);

const int analogPin = A0;
const int strobePin = 2;
const int resetPin = 3;

int spectrumValue[7]; // to hold a2d values

int doubledSpectrumValue[13];
int avg = 0;

void setup()
  strip.show(); // Initialize all pixels to 'off'

  pinMode(analogPin, INPUT);
  pinMode(strobePin, OUTPUT);
  pinMode(resetPin, OUTPUT);
  digitalWrite(resetPin, LOW);
  digitalWrite(strobePin, HIGH);

void loop()
  digitalWrite(resetPin, HIGH);
  digitalWrite(resetPin, LOW);
  //Measure the magnitudes of the 7 frequency bins

  avg = 0;
  for (int i = 0; i < 4; i++)
    digitalWrite(strobePin, LOW);
    delayMicroseconds(30); // to allow the output to settle

    spectrumValue[i] = analogRead(analogPin);
    avg += spectrumValue[i];
    digitalWrite(strobePin, HIGH);

  avg = avg/7;

  //Clear out the NeoPixel String

  for(int i = 0; i < 144; i++){
    strip.setPixelColor(i, strip.Color(0, 0, 0));
  //Draw the meter on the NeoPixel string

  for(int i = 0; i < map(avg, 0, 500, 0, 144); i++){
        strip.setPixelColor(i, strip.Color(i*4, 60 - i, map(spectrumValue[0], 0, 1023, 0, 60))); //Added blue flash for bass hit


So basically when we notice a higher value in the lowest band which is basically due to the percussion instruments used in the song. We make the whole strip flash. Check this out in the video below.

The song is by Adiba Parveen just in case you like it. Its here.