Search code examples
javaandroidaudiofrequencyfrequency-analysis

Frequency detection for guitar tuning


I am planning to implement a mobile guitar tuner app. I did an initial research and found out some commonly used methods for pitch detection such as fast Fourier transformation , autocorrelation ,etc.

I have also found out that FFT is not a very good mechanism to detect frequency. Since there are 2 parts in this project which is detecting the frequency of a guitar string and matching that frequency with the frequency which the string should be in,i thought of using an already implemented class library for detecting the frequency of a string.

I currently have no idea how tough this project will be, so my question is which part of the project is tougher? Is it matching the 2 frequencies or detecting a frequency of a string ? Also is there a way to use the FFT but at the same time get the accurate frequency of the string.

Thank you for your time.


Solution

  • The TarsosDSP project, a java audio processing library, contains several pitch detection algorithms. You can test them using the provided pitch detection example, an see which one works best in your case. The source code can be found on the TarsosDSP github page

    Pitch detection algorithms

    The library is open source and available on Android. I think it is a good match for your application.

    To match a frequencies to a target frequencies, i would convert both to the absolute cents scale (or MIDI cents). 100 cents equals a semi-tone. You then can round up to the nearest 100 to get the assumed target tone. Consult this page to convert frequencies in hertz to cents