3

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.

Troller
  • 1,108
  • 8
  • 29
  • 47
  • You wont get accurate frequency due to hardware specification – Antoniossss Aug 26 '14 at 17:30
  • Not right place to ask this question. Only code related questions ought to be posted here. – Psypher Aug 26 '14 at 17:31
  • @Antoniossss do you mean since the program will be getting the input through a mic ? – Troller Aug 26 '14 at 17:33
  • @Ranjith sorry , i saw a question regarding frequency which was some what similar to mine. That's why i posted mine here. – Troller Aug 26 '14 at 17:34
  • Try posting it in android.stackexchange.com. – Psypher Aug 26 '14 at 17:37
  • @Shehan.W that is correct. I used such applications for tuning my guitarr but it was hmm not accurate – Antoniossss Aug 26 '14 at 18:09
  • Building a fully chromatic tuner (e.g. one with no a-priori knowledge of the note to be detected is a very hard problem. Implementing it on Android - where you have few guarantees of the quality and frequency response of the device's microphone is also hard. You'll want to disable the HPF on the mic, and AGC. – marko Aug 27 '14 at 09:14

2 Answers2

3

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

Joren
  • 286
  • 2
  • 2
0
  • There are numerous libraries that can help you do this.

  • The phone mic should be able to detect the audible spectrum you want

  • Detecting frequency is the first part, FFT should be able to do this

  • Transferring frequency to pitch is something you'll have to think about

  • matching frequencies is just the second part

Here's a good start:

Frequency detection and pitch tracking in java

FFTW is the 'fastest fourier transform in the west', and has some Java wrappers:

FFT JAVA library