Instructables

Arduino / Processing Audio Spectrum Analyzer

Picture of Arduino / Processing Audio Spectrum Analyzer
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

Picture of Required Materials/Software and Where to Get Them
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/

mnedix3 months ago
It's a wonderful project, is it possible to make this without Arduino?
Keanan (author)  mnedix3 months ago
A microprocessor of some kind is required to drive the display.
mnedix Keanan3 months ago
Yes, an ATMega or a PIC will be required, I am really interested in a schematic + source code.

Anyone has such a thing?
hi.
how to make ardunio source for max7219 (8x8matrix use)
it was too hard to make source
help~~
Romeo19814 months ago
how do I change the audio source? I want to use my music on my PC that is connected to my surround stereo system via Toslink and I would like to have the line in set to my speaker out (optical) so when I play music in media player or games or what not I want the sounds to display on the 32x16 bicolour matrix display. any help would be great, PS stereo system does not have preouts so I can't hook up a cable from my stereo, back to my computer line in.
Keanan (author) 1 year ago
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.
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)  osmsoses1 year ago
Here's a library for the MSGEQ7.
https://github.com/justinb26/MSGEQ7-library
I just ran across this and remembered you.
Keanan (author)  osmsoses1 year ago
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
mfdupuis1 year ago
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?
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
sstrunks131 year ago
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)  sstrunks131 year ago
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.
jimdsouza1 year ago
Is this the same as a real time sound/music graphic equalizer? Or are they different?
I finally got it working, its a little annoying to get the sound input right but it works and looks really cool.
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
HI,
This is very good. But I have only one question. Can I connect directly the sound to the arduino?

PedroRamalho
srainsdon1 year ago
kinda off topic, what about going the other way around. ie audio in to arduino vu on computer
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)  recordmasta0012 years ago
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/
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
mfdupuis2 years ago
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)  mfdupuis2 years ago
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 Keanan2 years ago
Thanks for getting back to me! I didn't realize that there was a software update that used new extensions.
Ghild.Zero2 years ago
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!