Arduino / Processing Audio Spectrum Analyzer

 by Keanan
2012-02-24 17-37-06.835.jpg
2012-02-24 17-35-52.729.jpg
In this Instructable I am going to show how to make a program in Processing that analyzes sound on your computer and sends data to an Arduino that controls an LED matrix to show the spectrum analysis.

I will be explaining where to get materials, explaining the coding and wiring needed and providing example programs that can be adapted.

I will be using an Arduino Nano and and a 32x16 LED Matrix from Sure Electronics.
 
Remove these adsRemove these ads by Signing Up

Step 1: Required Materials/Software and Where to Get Them

DE-DP14112_2_b[1].jpg
The required materials are:
  1) An Arduino(doesn't really matter which version/variant)
  2) LED Matrix (for this Instructable, I use a 32x16 bicolor matrix, but any matrix should work)
  3) A driver chip if your LED matrix doesn't have them integrated, I will be explaining this in more depth.

Inexpensive LED Matrices: Sure Electronics: http://stores.ebay.com/Sure-Electronics
The display I use: http://www.ebay.com/itm/P4-32X16-RG-Bicolor-LED-3mm-Dot-Matrix-Unit-Board-/350527814626?

Required Software:
  1) Arduino IDE (I am using version 1.0) found here: http://arduino.cc/en/Main/Software
  2) Processing IDE found here: http://processing.org/download/

Keanan (author) says: Oct 10, 2012. 8:29 PM
Sorry i haven't replied in a while, things have come up. I am currently working on an Arduino stand-alone spectrum analyzer. I am waiting for the Due to come out before resuming my work.
osmsoses in reply to KeananNov 4, 2012. 3:20 PM
Hello , I am doing almost the same thing as your project, except that I'll be using RGB LEDs and actually solder them onto a PCB and not use an already built LED matrix. I'm using the Arduino Leonardo and a MSGEQ7 IC which is a graphic equalizer IC with 7 bands. I'll be making 7 columns of RGB LEDs. Each column will somehow correspond to the 7 different frequencies through the digital output pins (CLK, Data, Latch) with 74HC595 shift registers in series.

Since i'll be using 7 frequencies, will i need to connect each of the 7 columns to 7 different digital output pins on arduino leonardo?

--or-- just connect the shift registers from all the 7 columns in series (daisy-chained) and let the arduino know what frequency band will correspond to each column? (if so, does the arduino need to be programmed already to know what frequency will correspond to each band?)

--or-- all the Shift registers from each column be hardwired in series independently from the other columns??

I'm stuck here and have a deadline for this... Please help!
Keanan (author) in reply to osmsosesDec 28, 2012. 3:16 AM
Here's a library for the MSGEQ7.
https://github.com/justinb26/MSGEQ7-library
I just ran across this and remembered you.
Keanan (author) in reply to osmsosesNov 4, 2012. 5:13 PM
Okay, so if I understand correctly, you will use MSGEQ7 IC to process your audio. The MSGEQ7 then sends 7 Analog signals in sequence that represent the max peak of these frequencies: 63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz and
16kHz. You then will use a Leonardo to read the data and output corresponding levels to seven columns of RGB LEDs. The seven columns of LEDs will be driven by shift registers. Every 3 shift registers can control 8 RGB LEDs(1 for 8 red, 1 for 8 blue, 1 for 8 green). So for a matrix of 7x8 RGB LEDs, 21 shift registers will be needed. These could be daisy chained to only use 3 digital pins on the Leonardo, or they could be split up.
The MSGEQ7 will need to be hooked up as stated in it's datasheet: https://www.sparkfun.com/datasheets/Components/General/MSGEQ7.pdf
mfdupuis says: Dec 25, 2012. 7:26 AM
Hey! This is an awesome project, and I got it working. But now I'm trying to make a stand-alone system. Have you had any luck? What signal processing board do you use?
matt.e.jenkins says: Dec 3, 2012. 7:15 AM
Hi, great project! I have been looking into something like this for a while. I saw you're working on a stand alone version. I just was this by adafruit. http://www.youtube.com/watch?v=Tmpl5KA02S4
It may be a help. I just made a one color 8x8 matrix with a max7219. I wonder how easy or hard it would be to transfer adafruits code to use a max7219. It's a bit over my head but I'd be very interested if you have any ideas. Thanks,
Matt
sstrunks13 says: Nov 12, 2012. 3:06 PM
Hi! Great project, looking forward to building me one of these some day. Just out of curiosity, have you been able to daisy chain more than two displays using this library?
Keanan (author) in reply to sstrunks13Nov 13, 2012. 3:09 PM
I only have one display. I'm not sure if this library supports more than two displays. Even if it did, the Arduino isn't fast enough to really drive more than two, unless low frame rate wasn't an issue. Maybe the Due could control more.
jimdsouza says: Sep 29, 2012. 2:17 AM
Is this the same as a real time sound/music graphic equalizer? Or are they different?
tomtortoise says: Aug 16, 2012. 6:06 AM
I finally got it working, its a little annoying to get the sound input right but it works and looks really cool.
Luiz Antonio Nascimento says: Aug 3, 2012. 10:50 PM
First congratulations for your work:
I wonder how can I use instead of using pixel dot matrix Ws 2801, you have video on this Youtobe spectral analyzer
pedroramalho says: Jun 28, 2012. 9:36 AM
HI,
This is very good. But I have only one question. Can I connect directly the sound to the arduino?

PedroRamalho
srainsdon says: May 24, 2012. 11:50 PM
kinda off topic, what about going the other way around. ie audio in to arduino vu on computer
recordmasta001 says: Apr 8, 2012. 1:04 PM
So if it takes it from the stereo mix:

Does it work with windows and mac?

Could you modify the code so that it takes a line in from a device?

Thanks
Keanan (author) in reply to recordmasta001Apr 8, 2012. 2:03 PM
Windows will work without any problems. "An AudioInput is a connection to the current record source of the computer. How the record source for a computer is set will depend on the sound-card and OS, but typically a user can open a control panel and set the source from there. Unfortunately, there is no way to set the record source from Java. This is particularly problematic on the Mac because the input will always wind up being connected to the Mic-In, even if the user has set the input differently using their audio control panel."

Source: http://code.compartmental.net/tools/minim/manual-audioinput/
recordmasta001 in reply to KeananApr 9, 2012. 3:28 AM
I was looking at this the other day:
http://www.instructables.com/id/LoL-Shield-Audio-Spectrum-VU-Meter/

Could you do something similar in that a line in is connected to the arduinos analogue pins in an analogue read type setup. Then the device would be completely separate from the computer, thus eliminating os problems.

Cheers for the response
mfdupuis says: Mar 4, 2012. 7:50 PM
This project looks awesome, thanks for posting!

Questions: what exactly is the .ino file? Did you mean to say that the .pde is for Arduino and .ino for Processing? Do they do the same thing?

Thanks!

PS: Commented previously but found what I was looking for.
Keanan (author) in reply to mfdupuisMar 5, 2012. 4:25 PM
the .ino file is for Arduino IDE 1.0
the .pde is for Processing
they do not do the same thing.
the processing sketch runs on the computer while the Arduino sketch is uploaded to the Arduino and runs on the Arduino
mfdupuis in reply to KeananMar 5, 2012. 9:17 PM
Thanks for getting back to me! I didn't realize that there was a software update that used new extensions.
Ghild.Zero says: Mar 4, 2012. 7:50 AM
Wow very cool man !!!
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!