title: get frenquencies in Processing with Minim
body: <p>I try to get frequencies from microphone using Processing. I have mix two examples from the doc, but "highest" is not really in Hz (a is 440 Hz).
  Do you know how to have something better than this ?  </p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>import ddf.minim.*;
  import ddf.minim.analysis.*;
  
  Minim minim;
  AudioInput in;
  FFT fft;
  int highest=0;
  
  void setup()
  {
    size(1024, 200, P2D);
  
    minim = new Minim(this);
    minim.debugOn();
  
    in = minim.getLineIn(Minim.MONO, 4096, 44100);
    fft = new FFT(in.left.size(), 44100);
  }
  
  void draw()
  {
  
  
    background(0);
    stroke(255);
  
    fft.forward(in.left);
    highest=0;
    for (int n = 0; n &lt; fft.specSize(); n++) {
      // draw the line for frequency band n, scaling it by 4 so we can see it a bit better
      line(n/4, height, n/4, height - fft.getBand(n)*4);
  
      //find frequency with highest amplitude
      if (fft.getBand(n)&gt;fft.getBand(highest))
        highest=n;
    }
    println(highest);
  
    //println(fft.getFreq(110));
    // draw the waveforms
    for (int i = 0; i &lt; in.bufferSize() - 1; i++)
    {
      line(i, 50 + in.left.get(i)*50, i+1, 50 + in.left.get(i+1)*50);
      line(i, 150 + in.right.get(i)*50, i+1, 150 + in.right.get(i+1)*50);
    }
  }
  
  
  void stop()
  {
    // always close Minim audio classes when you are done with them
    in.close();
    minim.stop();
  
    super.stop();
  }
  </code></pre>