Peggy 2.0 Audio spectrum analyzer
  • Hey,
    Iv just ordered my peggy 2.0 and am in the process of thinking of some ideas to customize it. Would anyone have any ideas on how to turn the display into an audio spectrum analyzer? 
    Any thoughts or ideas would be much appreciated.
    Regards, Jack L 
  • Running the LED display takes a certain amount of CPU time, as would running spectrum analyzer code, so while I am certain that it can be done, I am not certain *how fast* it would be. 

    You might begin by looking at the Peggy2 library for Arduino and the existing FFT spectrum analyzer code out there; here's an example that might be a good starting point to look at: http://blog.arduino.cc/2010/11/16/arduino-realtime-audio-spectrum-analyzer-with-video-out/
  • Hi again Windell,

    Iv made some progress on the issue, mirror Peggy works very well and am delighted with it. At the moment im trying to display the input from my laptops microphone on my Peggy. I found this code which works well and clearly shows the different levels. Im just not too sure on how to modify it to send or mirror it to the Peggy, this is the code....

    import krister.Ess.*;

    FFT myfft;
    AudioInput myinput;
    int bufferSize=512;

    void setup() {
      size(532,400);
      frameRate(30);
      background(255);
      noStroke();
      fill(0);

      Ess.start(this);
      myinput=new AudioInput(bufferSize);
      myfft=new FFT(bufferSize*2);
      myinput.start();

      myfft.damp(.3);
      myfft.equalizer(true);
      myfft.limits(.005,.05);
    }

    void draw() {
      background(255);
      for (int i=0; i<bufferSize;i++) {
        rect(i+10,390,1,myfft.spectrum[i]*-400);
      }
    }

    public void audioInputData(AudioInput theInput) {
      myfft.getSpectrum(myinput);
    }

    Any help you could give me would be much appreciated as always,
    Below is the link to where i found the code,

  • I also found this video on Youtube of spectrum analyser working on the peggy, but i couldn't find the code he used 

  • It sounds like you're at a stage where you could take the data generated by the FFT program and make it so that you could put its data-- instead of the data from the camera --in the data array that gets sent (1) to your screen and (2) to the Peggy in the Mirror Peggy sketch.  And, that would be the most straightforward way to do so.