loading

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.

Step 1: 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/

<p>Thanks for the tutorial! Unfortunately, I'm using a different LED matrix which includes different driver chips as well. Here is the matrix I'm using: <a href="http://www.adafruit.com/product/420" rel="nofollow">http://www.adafruit.com/product/420 </a> </p><p>Is there an easy way to convert the code to work with the Adafruit_GFX or RGBmatrixPanel libraries? Thanks!</p>
<p>Well that display would be better driven by a more powerful microcontroller or FPGA, but it is possible. First wiring will require 12 pins on the Arduino. Using Adafruits GFX library will be a very smooth transition though. Mainly just replace and add the libraries, and change the line calls in the code to match the format of the GFX line methods: matrix.drawLine(X1,Y1,X2,Y2, matrix.Color333(r, g, b));<br><br>I'm not sure if the Color333(r,g,b) method understands a single uint32_t value instead of 3 r,g,b values, I'll look into it.<br><br>You don't need to call the dotmatrix.sendframe(); as the board automatically draws the lines when you call each drawLine method.<br><br>As I don't have this board, it will be difficult to help further, but if you have more questions, feel free to ask.<br><br>Also for more info, follow the tutorial at <a href="https://learn.adafruit.com/32x16-32x32-rgb-led-ma..." rel="nofollow"> </a><a href="https://learn.adafruit.com/32x16-32x32-rgb-led-matrix" rel="nofollow">https://learn.adafruit.com/32x16-32x32-rgb-led-mat...</a></p><p><br><br><strong>EDIT:</strong><br>Okay, I've been looking through the RGBmatrixPanel and the Color333 method does not recognize uint32_t variables, so my function above would not work, but I have submitted an issue request to Adafruit to add the feature, so maybe they'll add it, but I doubt it as they haven't changed it in 6 months.<br><br>But good news for now, I have forked the project and included the changes:<br><a href="https://github.com/Aerospacesmith/RGB-matrix-Panel" rel="nofollow">https://github.com/Aerospacesmith/RGB-matrix-Panel</a></p><p><br>I also added the ability to call a Color(r,g,b) method.<br><br>Example:<br><br>RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);<br>uint32_t BLACK = matrix.Color(0,0,0);<br>uint32_t ORANGE = matrix.Color(7,3,0); //Color333 uses values of 0-7.<br><br>void setup() {<br>matrix.begin();<br>matrix.drawLine(X1,Y1,X2,Y2,matrix.Color333(BLACK));<br>matrix.drawLine(X1,Y1,X2,Y2,matrix.Color333(ORANGE));<br>}<br>void loop(){}<br><br><br>I have created test sketches and they compile so it should work, but again, I do not have this board so I cannot test if it actually works.</p><p> Please let me know if my altered library works.</p>
<p>Wow, I'm not sure what you did to the library, but it worked! I copied your example code directly, inserted some coordinates to draw an X on the matrix, and it worked! I also had to change the colors for BLACK real quick because the black didn't show up on the matrix (obviously).</p><p>What next steps do I need to take to get your rendition of the code to work? Thanks again for your time!</p>
<p>Sorry for not replying sooner. Life tends to get in the way very often.<br><br>Anyway, I'm not sure if you figured it out yet, but should be most/all the changes needed (hopefully):<br><br>#include &lt;Adafruit_GFX.h&gt; // Core graphics library<br>#include &lt;RGBmatrixPanel.h&gt; // Hardware-specific library<br><br>#define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega)<br>#define LAT A3<br>#define OE 9<br>#define A A0<br>#define B A1<br>#define C A2<br><br>Make your new matrix library call:<br>RGBmatrixPanel dotmatrix(A, B, C, CLK, LAT, OE, false);<br><br>Then <strong>before </strong>setup() add the various colors, example Orange is 7,3,0; Red 7,0,0; Green 0,7,0 or ANY color you want since you have that board.<br>Just make sure to declare them as uint32_t types like</p><p>uint32_t BLACK = dotmatrix.Color333(0,0,0);<br>uint32_t GREEN = dotmatrix.Color333(0,7,0);<br>uint32_t RED = dotmatrix.Color333(7,0,0);<br>uint32_t YELLOW = dotmatrix.Color333(7,3,0);</p><p>Remove the dotmatrix.clear(); and replace it with<br>dotmatrix.fillScreen(BLACK);<br>this essentially fills the screen with black and clears it.</p><p><br>Then in each line call: dotmatrix.line(x1,y1,x2,y2,color); change the method from line to match the new libraries drawLine.<br>ex: dotmatrix.drawLine(x1,y1,x2,y2,GREEN);<br><br>Change the pixel calls from dotmatrix.plot(x,y,color); to dotmatrix.drawPixel(x,y,color).<br><br>And finally remove the dotmatrix.sendframe(); as this library/matrix driver pushes and draws the screen on every draw command and doesn't need a draw screen command. However this is also a caveat as drawing the screen on each command will slow down the display.</p>
<p>Great job <a href="http://www.instructables.com/member/Keanan" rel="nofollow">Keanan</a>. I got DE-DP14116 the re-designed 3216 3mm from Sure Electronics. The connector is different and it requires a 12V power supply. </p><p>Whats the wire diagram from the 10pin connector to Arduino for DE-DP14116?</p><p>Secondly I got Arduino compile errors. Suggestions?</p><p>Arduino: 1.6.9 (Windows 10), Board: &quot;Arduino/Genuino<br>Uno&quot;</p><p>In file included from C:\Program Files<br>(x86)\Arduino\Audio_Spectrum_from_Processing_3216_double_bar_ino\Audio_Spectrum_from_Processing_3216_double_bar_ino.ino:1:0:</p><p>C:\Program Files<br>(x86)\Arduino\libraries\ht1632c/ht1632c.h:168:34: error: 'prog_uint16_t' has<br>not been declared</p><p> void putbitmap(int x, int y,<br>prog_uint16_t *bitmap, byte w, byte h, byte color);</p><p> <br>^</p><p>C:\Program Files<br>(x86)\Arduino\libraries\ht1632c/ht1632c.h:192:5: error: 'prog_uint8_t' does not<br>name a type</p><p> prog_uint8_t *font;</p><p> ^</p><p>C:\Program Files<br>(x86)\Arduino\libraries\ht1632c/ht1632c.h:193:5: error: 'prog_uint16_t' does<br>not name a type</p><p> prog_uint16_t *wfont;</p><p> ^</p><p>exit status 1</p><p>Error compiling for board Arduino/Genuino Uno.</p><p>Thanks in advance!</p>
<p>Hi guys! I'm working on a project for class and I was wondering if anyone could help me figure out how to pick up a note through waveform when played on a guitar so it is read through the computer microphone and transferred to spectrum analysis? Thanks!</p>
<p>best way i can think of is to use virtual audio cable. It creates and combines a output source and input source. so then you use the included software to send your input (your Guitar) into the virtual audio cable output. if you are having troubles, pm (Private message) my Instructables account. :D Good Luck! </p>
<p>You don't use any audio chips ? Because i'm seeing in other projects people using.</p>
<p>Thank you for the tutorial! Would it be possible to do this using addressable WS2811 LED strips that a are mounted in a row of 36 by 10 LEDs. I need them to be strips since I am placing the LEDs on fabric. Any recommendations would be greatly appreciated. Thank! The picture shows sort of what I am trying to achieve. </p>
<p>Do you have a video showing the visual effect acquired with this project?</p>
LED Matrices even these ones with drivers included are based on anode common/catode common. Do you think I can use a different arrangement of this matrix if I use a bigger one, but with same number of rows and LEDs? I mean, the display itself it's too small for the purpose I'm using them for, so in theory, I could another matrix with a bigger set position but same config and plugges in the same fashion in the driver and all, couldn't I?<br>This is meant for stereo sound and shows both channels or I would have to build a second one if I needed a separated channel spectrum analyser?
<p>HI, I made processing ( using 1.51 instead of the new 3.0, because it doesn't seem to work with 3.0) and arduino work. Your new code for Adafruit Matrix compiled perfectly ( even better than the first one in my case). So, the source of sound is the computer or the line in? If I play music from my PC ( With foorbar or WMP for example) will it work? or this have to come from the line in? And can we switch source? I don,t have the Led matrix yet to fully test it. Also you arduino code for led control could potentially by modified to display anything? like text I supposed.<br><br>Thank and great project.</p>
<p>2 -Processing code : I've combine Keanan code to code from the getline.in code in the minim example library. Now it proprely work, you also need to see you stereo mix in windows sound setting as recording device. </p><p><br>import ddf.minim.analysis.*;<br>import ddf.minim.*;<br>import processing.serial.*; //library for serial communication<br><br>Serial port; //creates object &quot;port&quot; of serial class<br><br>Minim minim;<br>AudioInput in;<br><br>FFT fft;<br>float[] peaks;<br>int peak_hold_time = 1; // how long before peak decays<br>int[] peak_age; // tracks how long peak has been stable, before decaying<br><br>// how wide each 'peak' band is, in fft bins<br>int binsperband = 5;<br>int peaksize; // how many individual peak bands we have (dep. binsperband)<br>float gain = 40; // in dB<br>float dB_scale = 2.0; // pixels per dB<br><br>int buffer_size = 1024; // also sets FFT size (frequency resolution)<br>float sample_rate = 44100;<br><br>int spectrum_height = 176; // determines range of dB shown<br><br>int[] freq_array = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};<br>int i,g;<br>float f;<br><br><br>float[] freq_height = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //avg amplitude of each freq band<br><br>void setup()<br>{<br> size(512, 200, P2D);<br><br> minim = new Minim(this);<br> //minim.debugOn();<br>// port = new Serial(this, Serial.list()[1],9600); //set baud rate<br> port = new Serial(this,&quot;COM4&quot;,115200);<br> <br> // get a line in from Minim, default bit depth is 16<br> //in = minim.getLineIn(Minim.mono, 512, sample_rate);<br> in = minim.getLineIn(Minim.MONO,buffer_size,48000);<br> // create an FFT object that has a time-domain buffer <br> // the same size as line-in's sample buffer<br> fft = new FFT(in.bufferSize(), in.sampleRate());<br> // Tapered window important for log-domain display<br> fft.window(FFT.HAMMING);<br><br> // initialize peak-hold structures<br> peaksize = 1+Math.round(fft.specSize()/binsperband);<br> peaks = new float[peaksize];<br> peak_age = new int[peaksize];<br>}<br><br>void draw()<br>{<br>for(int k=0; k&lt;16; k++){<br>freq_array[k] = 0;<br>}<br><br> // perform a forward FFT on the samples in input buffer<br> fft.forward(in.mix);<br> <br>// Frequency Band Ranges <br> freq_height[0] = fft.calcAvg((float) 0, (float) 50);<br> freq_height[1] = fft.calcAvg((float) 51, (float) 69);<br> freq_height[2] = fft.calcAvg((float) 70, (float) 94);<br> freq_height[3] = fft.calcAvg((float) 95, (float) 129);<br> freq_height[4] = fft.calcAvg((float) 130, (float) 176);<br> freq_height[5] = fft.calcAvg((float) 177, (float) 241);<br> freq_height[6] = fft.calcAvg((float) 242, (float) 331);<br> freq_height[7] = fft.calcAvg((float) 332, (float) 453);<br> freq_height[8] = fft.calcAvg((float) 454, (float) 620);<br> freq_height[9] = fft.calcAvg((float) 621, (float) 850);<br> freq_height[10] = fft.calcAvg((float) 851, (float) 1241);<br> freq_height[11] = fft.calcAvg((float) 1242, (float) 1600);<br> freq_height[12] = fft.calcAvg((float) 1601, (float) 2200);<br> freq_height[13] = fft.calcAvg((float) 2201, (float) 3000);<br> freq_height[14] = fft.calcAvg((float) 3001, (float) 4100);<br> freq_height[15] = fft.calcAvg((float) 4101, (float) 5600);<br> <br><br>// Amplitude Ranges if else tree<br> for(int j=0; j&lt;16; j++){ <br> if (freq_height[j] &lt; 200000 &amp;&amp; freq_height[j] &gt; 200){freq_array[j] = 16;}<br> else{ if (freq_height[j] &lt;= 300 &amp;&amp; freq_height[j] &gt; 150){freq_array[j] = 15;}<br> else{ if (freq_height[j] &lt;= 250 &amp;&amp; freq_height[j] &gt; 125){freq_array[j] = 14;}<br> else{ if (freq_height[j] &lt;= 200 &amp;&amp; freq_height[j] &gt; 100){freq_array[j] = 13;}<br> else{ if (freq_height[j] &lt;= 160 &amp;&amp; freq_height[j] &gt; 90){freq_array[j] = 12;}<br> else{ if (freq_height[j] &lt;= 150 &amp;&amp; freq_height[j] &gt; 75){freq_array[j] = 11;}<br> else{ if (freq_height[j] &lt;= 140 &amp;&amp; freq_height[j] &gt; 65){freq_array[j] = 10;}<br> else{ if (freq_height[j] &lt;= 120 &amp;&amp; freq_height[j] &gt; 50){freq_array[j] = 9;}<br> else{ if (freq_height[j] &lt;= 50 &amp;&amp; freq_height[j] &gt; 45){freq_array[j] = 8;}<br> else{ if (freq_height[j] &lt;= 45 &amp;&amp; freq_height[j] &gt; 40){freq_array[j] = 7;}<br> else{ if (freq_height[j] &lt;= 40 &amp;&amp; freq_height[j] &gt; 35){freq_array[j] = 6;}<br> else{ if (freq_height[j] &lt;= 35 &amp;&amp; freq_height[j] &gt; 30){freq_array[j] = 5;}<br> else{ if (freq_height[j] &lt;= 30 &amp;&amp; freq_height[j] &gt; 15){freq_array[j] = 4;}<br> else{ if (freq_height[j] &lt;= 15 &amp;&amp; freq_height[j] &gt; 10){freq_array[j] = 3;}<br> else{ if (freq_height[j] &lt;= 10 &amp;&amp; freq_height[j] &gt; 5){freq_array[j] = 2;}<br> else{ if (freq_height[j] &lt;= 5 &amp;&amp; freq_height[j] &gt;= 1 ){freq_array[j] = 1;}<br> else{ if (freq_height[j] &lt; 1 ){freq_array[j] = 0;}<br> }}}}}}}}}}}}}}}}}<br><br>/* background(0); // This code Draw the FFT on a black small windows, useful to //verify if it work, if you wan you want to test undo the // to make it active.<br> stroke(255);<br> // perform a forward FFT on the samples in jingle's left buffer<br> // note that if jingle were a MONO file, this would be the same as using jingle.right or jingle.left<br>// fft.forward(jingle.mix);<br> for(int i = 0; i &lt; fft.specSize(); i++)<br> {<br> // draw the line for frequency band i, scaling it by 4 so we can see it a bit better<br> line(i, height, i, height - fft.getBand(i)*4);<br> }<br> fill(255); */<br>// End of windows drawing.<br> <br> //send to serial<br> port.write(0xff); //write marker (0xff) for synchronization<br> <br> for(i=0; i&lt;16; i++){<br> port.write((byte)(freq_array[i]));<br> }<br> //delay(2); //delay for safety<br>}<br> <br><br><br><br>void stop()<br>{<br> // always close Minim audio classes when you are done with them<br> in.close();<br> minim.stop();<br> <br> super.stop();<br>}</p>
<p>I had lot of problem with processing not proprely reading audio input, also you arduino code miss something don't forget.<br>in void setup</p><p>dotmatrix.begin(); THIS one is VERY important, in all RGB example then have this matrix.begin(), you call yours dotmatrix, work fine.<br><br>Here my complete code for adafruit + arduino. it's not perfect yet, still no as smooth as I wish but it work<br> 1 -Arduino code, </p><p>#include &lt;Adafruit_GFX.h&gt; // Core graphics library<br>#include &lt;RGBmatrixPanel.h&gt; // Hardware-specific library<br><br>#define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega)<br>#define LAT A3<br>#define OE 9<br>#define A A0<br>#define B A1<br>#define C A2<br><br>RGBmatrixPanel dotmatrix(A, B, C, CLK, LAT, OE, false);<br>int array[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};<br>int arraytemp[16] ={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};<br>int i,j,k,r;<br><br>uint32_t BLACK = dotmatrix.Color333(0,0,0);<br>uint32_t GREEN = dotmatrix.Color333(0,7,0);<br>uint32_t RED = dotmatrix.Color333(7,0,0);<br>uint32_t ORANGE = dotmatrix.Color333(7,3,0);<br><br>void setup ()<br>{ <br><br>dotmatrix.begin();<br> Serial.begin(115200);<br> dotmatrix.fillScreen(BLACK); // clear la matrix<br>}<br> <br> void loop()<br>{<br> //protocol expects data in format of 17 bytes<br> //(xff) as a marker to ensure proper synchronization always<br> /*if (!Serial.available()&gt;=17) {<br> for(r=0; r&lt;17; r++)<br> array[r]=0;<br> }<br> */<br> <br> if(Serial.read() == 0xff){<br> for(i=0; i&lt;16; i++){<br> array[i] = Serial.read();<br> <br> }<br> //switch case statement<br> for(j=0; j&lt;16; j++){ <br> if(array[j]!= arraytemp[j]){ <br><br> switch (array[j]) {<br> case 0:<br> dotmatrix.drawLine(2*j,0,2*j,15,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK); <br> break;<br> case 1:<br> dotmatrix.drawLine(2*j,0,2*j,15,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawPixel(2*j,15,GREEN);<br> dotmatrix.drawPixel(2*j+1,15,GREEN);<br> break;<br> case 2:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,14,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,14,GREEN);<br> break; <br> case 3:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,13,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,13,GREEN);<br> break;<br> case 4:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,12,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,12,GREEN);<br> break;<br> case 5:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,11,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,11,GREEN);<br> break;<br> case 6:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,10,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,10,GREEN);<br> break;<br> case 7:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,9,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,9,GREEN);<br> break;<br> case 8:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,8,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,8,GREEN);<br> break;<br> case 9:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,7,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,7,GREEN);<br> break;<br> case 10:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,6,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,6,GREEN);<br> break;<br> case 11:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,5,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,5,GREEN);<br> break;<br> case 12:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,4,ORANGE);<br> dotmatrix.drawLine(2*j,15,2*j,5,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,4,ORANGE);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,5,GREEN);<br> break;<br> case 13:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,3,ORANGE);<br> dotmatrix.drawLine(2*j,15,2*j,5,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,3,ORANGE);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,5,GREEN);<br> break;<br> case 14:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,2,ORANGE);<br> dotmatrix.drawLine(2*j,15,2*j,5,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,2,ORANGE);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,5,GREEN);<br> break;<br> case 15:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,1,RED);<br> dotmatrix.drawLine(2*j,15,2*j,2,ORANGE);<br> dotmatrix.drawLine(2*j,15,2*j,5,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,1,RED);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,2,ORANGE);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,5,GREEN);<br> break;<br> case 16:<br> dotmatrix.drawLine(2*j,15,2*j,0,BLACK);<br> dotmatrix.drawLine(2*j+1,0,2*j+1,15,BLACK);<br> dotmatrix.drawLine(2*j,15,2*j,0,RED);<br> dotmatrix.drawLine(2*j,15,2*j,2,ORANGE);<br> dotmatrix.drawLine(2*j,15,2*j,5,GREEN);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,0,RED);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,2,ORANGE);<br> dotmatrix.drawLine(2*j+1,15,2*j+1,5,GREEN);<br> break;<br> }<br> <br> arraytemp[j] = array[j];<br><br> }<br> <br> }<br><br>}<br> <br> delay(1);<br><br>}</p>
<p>http://www.ebay.com/itm/Arduino-Uno-Compatible-Dual-Channel-MSGEQ7-Spectrum-Analyzer-Shield-Board-/321981951925?hash=item4af79eafb5:g:c2IAAOSwFqJWoHMZ</p>
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?
<p>http://www.ebay.com/itm/Arduino-Uno-Compatible-Dual-Channel-MSGEQ7-Spectrum-Analyzer-Shield-Board-/321981951925?hash=item4af79eafb5:g:c2IAAOSwFqJWoHMZ</p>
HI, <br />This is very good. But I have only one question. Can I connect directly the sound to the arduino? <br /> <br />PedroRamalho
<p>http://www.ebay.com/itm/Arduino-Uno-Compatible-Dual-Channel-MSGEQ7-Spectrum-Analyzer-Shield-Board-/321981951925?hash=item4af79eafb5:g:c2IAAOSwFqJWoHMZ</p>
<p>im just wondering how the FFT program connects to the stereo mixer, the &quot;java (tm) platform se binary pops up but is not reading any audio levels, iv tried playing stuff from youtube and plugin my iphone still not reading anything </p>
<p>Thanks for the tutorial! but when i run the code on processing, there's and error: :(, help me pls !!</p>
<p>how did you fix this??? i am having the same problem</p>
Thanks for your inquiry,<br>This code was written in Processing 1.<br>It will have compiling errors in Processing 2.<br><br>Try running the code in Processing1
<p>I've tried on Processing 1 but the same error :(</p><p>Display 0 does not exist, using the default display instead.</p><p>WARNING: RXTX Version mismatch</p><p>Jar version = RXTX-2.2pre1</p><p>native lib Version = RXTX-2.2pre2</p><p>Exception in thread &quot;Animation Thread&quot; java.lang.ArrayIndexOutOfBoundsException: 1</p><p>at Audio_Spectrum_to_Arduino3216_doublebar.setup(Audio_Spectrum_to_Arduino3216_doublebar.java:68)</p><p>at processing.core.PApplet.handleDraw(Unknown Source)</p><p>at processing.core.PApplet.run(Unknown Source)</p><p>at java.lang.Thread.run(Thread.java:662)</p>
<p>Awesome!!</p>
<p>Is there a way that I can invert the output to the led's so they are inverted..like this</p><p>https://www.youtube.com/watch?v=OZyQ-g3klVU</p>
<p>I was wondering how you get the signal to the arduino? I want to be able to plug it into a audio desk. Is there anyway i can do this!???</p>
<p>Hi friend! First, thanks for the tutorial;<br> I have this module purchased on eBay - Then works with this ht1632c library?<br> Thank you</p>
<p>So first of all when i run the processing script i get an error on line 45. Replacing the [1] with [0] allows it to run. However i have not got it to work yet as when i go into the arduino sketch to change the pins mine is wired up to i get an error as follows:</p><p>Audio_spectrum_from_Processing.ino: In function 'void _data_clr()':</p><p>Audio_spectrum_from_Processing:3: error: 'volatile struct bits' has no member named 'b10'</p><p>Audio_spectrum_from_Processing.ino: In function 'void _wr_clr()':</p><p>Audio_spectrum_from_Processing:3: error: 'volatile struct bits' has no member named 'b11'</p><p>Audio_spectrum_from_Processing.ino: In function 'void _data_set()':</p><p>Audio_spectrum_from_Processing:3: error: 'volatile struct bits' has no member named 'b10'</p><p>Audio_spectrum_from_Processing.ino: In function 'void _wr_set()':</p><p>Audio_spectrum_from_Processing:3: error: 'volatile struct bits' has no member named 'b11' </p><p>Audio_spectrum_from_Processing.ino: In function 'void _data_out()':</p><p>Audio_spectrum_from_Processing:3: error: 'volatile struct bits' has no member named 'b10'</p><p>Audio_spectrum_from_Processing.ino: In function 'void _wr_out()':</p><p>Audio_spectrum_from_Processing:3: error: 'volatile struct bits' has no member named 'b11'</p><p>Any help please Keanan?</p>
<p>Errors:</p><p>Arduino: 1.6.3 (Windows 8.1), Board: &quot;Arduino Uno&quot;</p><p>Build options changed, rebuilding all</p><p>FY5KV8GGYZNVB9C.pde:8:1: error: 'import' does not name a type</p><p>FY5KV8GGYZNVB9C.pde:9:1: error: 'import' does not name a type</p><p>FY5KV8GGYZNVB9C.pde:10:1: error: 'import' does not name a type</p><p>FY5KV8GGYZNVB9C.pde:12:1: error: 'Serial' does not name a type</p><p>FY5KV8GGYZNVB9C.pde:14:1: error: 'Minim' does not name a type</p><p>FY5KV8GGYZNVB9C.pde:15:1: error: 'AudioInput' does not name a type</p><p>FY5KV8GGYZNVB9C.pde:16:1: error: 'FFT' does not name a type</p><p>FY5KV8GGYZNVB9C.pde:17:6: error: expected unqualified-id before '[' token</p><p>FY5KV8GGYZNVB9C.pde:20:4: error: expected unqualified-id before '[' token</p><p>FY5KV8GGYZNVB9C.pde:33:4: error: expected unqualified-id before '[' token</p><p>FY5KV8GGYZNVB9C.pde:38:6: error: expected unqualified-id before '[' token</p><p>FY5KV8GGYZNVB9C.pde: In function 'void setup()':</p><p>FY5KV8GGYZNVB9C.pde:42:16: error: 'size' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:44:3: error: 'minim' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:44:15: error: expected type-specifier before 'Minim'</p><p>FY5KV8GGYZNVB9C.pde:44:15: error: expected ';' before 'Minim'</p><p>FY5KV8GGYZNVB9C.pde:45:3: error: 'port' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:45:14: error: expected type-specifier before 'Serial'</p><p>FY5KV8GGYZNVB9C.pde:45:14: error: expected ';' before 'Serial'</p><p>FY5KV8GGYZNVB9C.pde:47:3: error: 'in' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:47:24: error: 'Minim' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:51:3: error: 'fft' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:51:13: error: expected type-specifier before 'FFT'</p><p>FY5KV8GGYZNVB9C.pde:51:13: error: expected ';' before 'FFT'</p><p>FY5KV8GGYZNVB9C.pde:53:14: error: 'FFT' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:56:16: error: 'Math' was not declared in this scope</p><p>In file included from FY5KV8GGYZNVB9C.pde:8:0:</p><p>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:88:22: error: expected unqualified-id before '(' token</p><p> #define round(x) ((x)&gt;=0?(long)((x)+0.5):(long)((x)-0.5))</p><p> ^</p><p>FY5KV8GGYZNVB9C.pde:56:21: note: in expansion of macro 'round'</p><p>FY5KV8GGYZNVB9C.pde:57:3: error: 'peaks' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:58:3: error: 'peak_age' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde: In function 'void draw()':</p><p>FY5KV8GGYZNVB9C.pde:65:1: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:69:3: error: 'fft' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:69:15: error: 'in' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:72:3: error: 'freq_height' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:92:58: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:93:62: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:94:62: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:95:62: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:96:61: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:97:61: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:98:61: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:99:61: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:100:60: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:101:60: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:102:60: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:103:60: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:104:60: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:105:60: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:106:59: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:107:60: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:108:36: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:112:3: error: 'port' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:115:23: error: 'freq_array' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde: In function 'void stop()':</p><p>FY5KV8GGYZNVB9C.pde:124:3: error: 'in' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:125:3: error: 'minim' was not declared in this scope</p><p>FY5KV8GGYZNVB9C.pde:127:3: error: 'super' was not declared in this scope</p><p>Error compiling.</p><p> This report would have more information with</p><p> &quot;Show verbose output during compilation&quot;</p><p> enabled in File &gt; Preferences.</p>
The fft code doesn't go in Arduino, it goes in Processing.
<p>it didnt even compile to load.</p><p>the fft is not including in the program to compile</p>
<p>sir i am unable to include fft library files pls help</p>
Your output shows that you tried to load the code in Arduino. The .PDE file goes in Processing. The .ino goes in Arduino.
<p>First of all, thank you for the tutorial. If it wouldn't be much to ask, could you give a list of the materials and the quantity necessary? </p><p>Thank you</p>
<p>Hey, I was wondering if we could use this for the LED matix? https://www.sparkfun.com/products/12583</p>
<p>Hi,I did all things about hardware but differently add microphone instead of jack input.</p><p>I have 16x64 rgb led panel and ard.uno.Before being crazy or broke everything please give me real working code or tell me something about hardware must change.</p><p>Thanks</p>
<p>I cannot find the code this article mentions, where is the link?</p>
<p>Nice job! I'm looking for some help with a project I'm working on. I'd like to display different animations on different LED matrix panels and control them all with one Arduino or BeagleBone Black. Any ideas? My failsafe is to combine several animations into one file and space them out so they look as if the different matrices are showing different animations.</p><p>Thanks for any advice or help anyone can offer!</p><p>- John</p>
<p>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.</p>
<p>also is there a way to change the speed it seems to have a delay from what comes out of the speakers to what is being displayed</p>
It's a wonderful project, is it possible to make this without Arduino?
A microprocessor of some kind is required to drive the display.
Yes, an ATMega or a PIC will be required, I am really interested in a schematic + source code. <br> <br>Anyone has such a thing?
hi. <br>how to make ardunio source for max7219 (8x8matrix use) <br>it was too hard to make source <br>help~~
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. <br> <br>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? <br> <br>--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?) <br> <br>--or-- all the Shift registers from each column be hardwired in series independently from the other columns?? <br> <br>I'm stuck here and have a deadline for this... Please help!
Here's a library for the MSGEQ7. <br>https://github.com/justinb26/MSGEQ7-library <br>I just ran across this and remembered you.
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 <br>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. <br>The MSGEQ7 will need to be hooked up as stated in it's datasheet: https://www.sparkfun.com/datasheets/Components/General/MSGEQ7.pdf <br>

About This Instructable

207,762views

239favorites

More by Keanan:Arduino / Processing Audio Spectrum Analyzer 
Add instructable to: