title: Auriotouch, get musical note from frequency FFT
body: <p>I'm developing a kind of guitar tuner.</p>
  
  <p>I have a function that gives me the FFT, and the values of the FFt for each frequency.</p>
  
  <p>How do I get the musical note from there? Do I have to chose the highest peak? </p>
  
  <pre><code> for(y=0; y&lt;maxY; y++){
  
  
      CGFloat yFract = (CGFloat)y / (CGFloat)(maxY - 1);          
  
      CGFloat fftIdx = yFract * ((CGFloat)fftLength);
      double fftIdx_i,fftIdx_f;
      fftIdx_f = modf(fftIdx, &amp;fftIdx_i);
  
      SInt8 fft_l, fft_r;
      CGFloat fft_l_fl, fft_r_fl;
      CGFloat interpVal;
  
      fft_l = (fftData[(int)fftIdx_i] &amp; 0xFF000000) &gt;&gt; 24;
      fft_r = (fftData[(int)fftIdx_i + 1] &amp; 0xFF000000) &gt;&gt; 24;
  
  
      fft_l_fl = (CGFloat)(fft_l + 80) / 64.;
      fft_r_fl = (CGFloat)(fft_r + 80) / 64.;
      interpVal = fft_l_fl * (1. - fftIdx_f) + fft_r_fl * fftIdx_f;
      interpVal = CLAMP(0., interpVal, 1.);
  
  
      drawBuffers[0][y] = (interpVal * 120);
      //NSLog(@"The magnitude for %f Hz is %f.", (yFract * hwSampleRate * .5), (interpVal * 120));
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks a lot if you can help.</p>
  
  <p>Julien.</p>