I am developing a type of guitar tuner.
I have a function that gives me FFT, and the value of FFT for each frequency.
How do I get music notes from there? Do I have to pick the highest peak? (Y = 0; y and lt; max; y ++) {CGFloat yFract = (CGFloat) y / (CGFlot) (max - 1);
for CGFloat fftIdx = yFract * ((CGFloat) fftLength); Double FFTIDX_I, FFTIDX_F; FftIdx_f = modf (fftIdx, and fftIdx_i); SInt8 fft_l, fft_r; CGFloat fft_l_fl, fft_r_fl; CGFloat Interpol; Fft_l = (fftData [(int] fftIdx_i] & 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, Interpol, 1); Drawers [0] [or] = (interpol * 120); // NSLog (@ "For Intensity is% FHz% F", (yFract * hwSampleRate * .5), (Interpaw * 120); }
Thank you very much if you can help.
Julian
- The peak may not be in conformity with the original harmonic (it may also be missing ).
- Elemental harmonic probably would not have landed properly at the center of an FFT bin, so its energy would spread to many compartments. You will need to interpolate to estimate the actual frequency.
- Unless you do any type of windowing, you will get the "spectral leak" effect, which will tarnish your spectrum throughout the place, which will make it difficult to see the details.
I appreciate it that it does not really answer your question, but it should highlight the fact that it is really a very difficult task to do it well is.
Comments
Post a Comment