Audio Spectrum Analyzer

I like running LEDs off my Arduino and I also like listening to music, so I thought it would be nice if I could give my Arduino pitch perfect hearing then we could make the LEDs do some neat stuff.

I found these audio spectrum analyzer chips that are used in car stereos, so I've whipped up a shield and hooked it all up to an array of LEDs. This is all running on an Arduino, no PC connected. In fact the Arduino is not even working that hard.


Details:

  • A 3.5mm Audio in connector for input.
  • Another 3.5mm connector for output to your speakers/stereo.
  • 7 Band real time spectrum analyzer (Stereo!) 63Hz, 160Hz, 400Hz, 1KHz, 2.5KHz, 6.25KHz, 16KHz
  • Only uses 2 digital pins and one analog.

For this example the LEDs are using 2 digital pins.
I'm only using the 5 lowest frequency bands here, I'll make a bigger array soon.
I've applied some automatic gain/attenuation to keep the display interesting and prevent it maxing out on noisy tracks.

This could be used for other types of audio analysis. Voice ID or audio fingerprinting may be possible.

I'll have some shields ready in 3 weeks time, I'll post back here when they are good to go.

That's brilliant!

Are you going to share hardware schematics and code?

Of course! I'll just tidy it up a bit, I got so excited I just had to show it off first. The analyzer chips are SMD, I just received a load of them, and I'll put them on my web store this weekend. For those who don't want to solder SMDs, the shields will be couple of weeks off. I was going to make them stereo, but now I'm thinking mono is fine. Visually represented, it's had to see any difference between the two channels as it turn out.

I'm working on a BPM sensing algorithm now. For those who like listening to dance music, it's a must have I think.

I'm not too good at soldering so I might wait for the shield.

Do you have a rough idea of cost?

Mind sharing where you found those spectrum chips?

edit - nvm if you will post them on your webstore thats good enough for me.

Here is the analyzer chip:
http://bliptronics.com/item.aspx?ItemID=111

Example circuit will follow shortly...

Do you have backwards sounding music because the analyzer is backwards from the usual bass on the left :slight_smile:

Very nice! i ordered some of your LEDs for my synthesizer project.

that is pretty great, but yeah, the bass on the right hand side makes my head hurt.

Amazing end result !
What material did you use as a diffuser? I've been looking around quite a while now and that's exactly what I need.
I suppose you're using BlinkM LEDs or some other type that have a small circuit to drive them?

For the diffuser I used corrugated plastic sheet (Coroplast) that I covered with silver vinyl adhesive (signwriters material). I made a grid and placed one LED at the back of each cell in the grid, and the faceplate is just white Perspex with a grid decal appled to the front with black vinyl.

The LEDs are a type that you can buy from me here.
http://bliptronics.com
Like BlinkM but a different controller and they come pre-wired.

You nearly ready to sell them as shields? It's been three weeks :slight_smile:

What if I would like to have more than 5 or 7 frequency ranges?

Well, you could use something with more power than an Arduino. Sample the audio, do a fourier transform on it and represent the analysis on the LEDs.

Alternatively do the analysis on a PC and then send the values to your arduino to display on the LEDs.

I haven't been able to find a simple audio spectrum analyzer chip that has more than seven bands, but there may well be some solution out there.

Cowjam: shields are being worked on - I had to change some parts - I've now added a connector for LEDs and a power input jack to power the LEDs. Just a few more weeks....

blip, I want to see if I understand that chip correctly. Setting the reset to high then low will reset the chip. then the strobe pin will start turning on and off. When it turns off the next frequency value is sent starting with the lowest immediately after the reset then looping infinitely through the frequencies.

How are you monitoring it? How do you know if you missed a frequency? Can out put up the code you used in that youtube video? Does it take line level or mic level audio input? If mic level then I would assume the value peaks will vary on the volume?

Edit: Oh wait, do you control the strobe pin?

You do the reset sequence (see below).
Then you just read the seven values sequentially.

Here's working code:

void initSpectrum()
{
//Init spectrum analyzer
  digitalWrite(spectrumStrobe,LOW);
    delay(5);
  digitalWrite(spectrumReset,HIGH);
    delay(5);
  digitalWrite(spectrumStrobe,HIGH);
    delay(5);
  digitalWrite(spectrumStrobe,LOW);
    delay(5);
  digitalWrite(spectrumReset,LOW);
    delay(5);
}


// Read 7 band equalizer.
void readSpectrum()
{
  byte Band;
  for(Band=0;Band <7; Band++)
  {
    digitalWrite(spectrumStrobe,HIGH);
    digitalWrite(spectrumStrobe,LOW);
    Spectrum[Band] = analogRead(spectrumAnalog);      //    Spectrum[Band] is a global array to hold the readings
  }
}

I am hoping someone out here can help. I got this chip along with an adapter to use with a breadboard.

I try the code provided and get the same reading many times before it goes to the next one, even when strobe is used. Also, it never goes back down to zero when the music stops, just gets lower.

I tried to use the circuit on datasheet page 4 (typical application), but not sure I understand what capacitor is needed on the clock pin (8) based on the symbol. Of course it is 33pf, but is this polarized or not?

Datasheet:
http://www.bliptronics.com/manuals/MSGEQ7.pdf

Has anyone else gotten this chip working on a breadboard and if so can you help me with the setup? Or can someone look at the symbol and help me understand what capacitor is needed on pin 8 (clock).

I verified the strobe pin is working by removing it and seeing the values go flat.

Note: When I use the reset pin and check the value, it reads correctly and instantly turns to zero when I stop the music. So if I reset / read / reset / read I can get the first band (maybe with no peak detection but I see it move with the music). I can't get more detail than that without some help from some kind soul.

Thanks

Here's a small article I wrote on the chip, maybe it will be of some help:

http://skoba.no-ip.org/msgeq7/index.html

@SpikedCola .. Thank you very much!

Your great article confirmed a normal capacitor, the need for a delay and results hovering around 60 when music off.

I didn't have a 33pf but had some 22pf's around for breadboarding the ATMega. I used two of those to make 44pf, just to try to get it running and it worked! I am seeing the same results as you when off and see logical changes and matched up columns :slight_smile:

What a fantastic chip and article - thanks folks.

That chip is mono, so for stereo input one can either combine the stereo signal into mono or use two of these chips, correct? If you use two chips one should be able to use one arduino pin for reset for both chips, same with strobe. But a separate analog pin for each chip, correct?