Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Robust algorithm for chromatic instrument tuner? [closed]

Who knows the most robust algorithm for a chromatic instrument tuner?

I am trying to write an instrument tuner. I have tried the following two algorithms:

  1. FFT to create a welch periodogram and then detect the peak frequency

  2. A simple autocorrelation (http://en.wikipedia.org/wiki/Autocorrelation)

I encountered the following basic problems:

  1. Accuracy 1: in FFT the relation between samplerate, recording length and bin size is fixed. This means that I need to record a 1-2 seconds of data to get an accuracy of a few cents. This is not exactly what i would call realtime.

  2. Accuracy 2: autocorrelation works a bit better. To get the needed accuracy of a few cents I had to introduced linear interpolation of samples.

  3. Robustness: In case of a guitar I see a lot of overtones. Some overtones are actually stronger than the main tone produced by the string. I could not find a robust way to select the right string played.

Still, any cheap electronic tuner works more robust than my implementation. How are those tuners implemented?

like image 565
Stiefel Avatar asked May 20 '10 12:05

Stiefel


People also ask

How to use a chromatic tuner?

How To Use A Chromatic Tuner? Playing with a tuner will help develop your intonation and an understanding of the tendencies of your instrument. To use this instrument tuner, make sure the built-in microphone has web access. Play any note. You will see the needle move and the strobe rotates until it finds the pitch you are playing.

What is a tuner?

A tuner is a device musicians use to detect pitch accuracy. It will let a musician know if the note they are playing is sharp (too high), flat (too low), or if it is in tune. The accuracy of a pitch is what musicians call intonation.

What instruments can you tune with an electric guitar tuner?

They can help you tune small instruments like guitar, bass, violin, or even read the accuracy of notes. This tool can apply to your clarinet, trumpet, trombone, flute, or French horn. They are also great in rejecting background noise, allowing a musician to tune any instrument in a busy and noisy background.

How does a guitar tuner work?

Tuners work by detecting the frequency of the pitch (sound waves). For example, an A is 440 Hz. If an A is sharp, it will be 441 Hz or higher. If it is flat, it will register as 439 Hz or lower. While tuners work by tracking hertz, musicians measure how close they are to the pitch in measurements of cents.


1 Answers

You can interpolate FFTs also, and you can often use the higher harmonics for increased precision. You need to know a little bit about the harmonics of the instrument that was produced, and it's easier if you can assume you're less than half an octave off target, but even in the absence of that, the fundamental frequency is usually much stronger than the first subharmonic, and is not that far below the primary harmonic. A simple heuristic should let you pick the fundamental frequency.

I doubt that the autocorrelation method will work all that robustly across instruments, but you should get a series of self-similarity scores that is highest when you're offset by one fundamental frequency. If you go two, you should get the same score again (to within noise and differential damping of the different harmonics).

like image 140
Rex Kerr Avatar answered Sep 22 '22 18:09

Rex Kerr