0

My goal is to measure the pitch of my violin with a small computer/microcontroller very accurately (a Raspberry Pi would be too big). I'm aiming for an accuracy of 0.1 Hz; 0.5 Hz could also work. The problem is that a violin produces a lot of frequencies known as harmonics. I only need the main frequency of each string, for example, 440 Hz.

I did a lot of research on the internet and performed some tests, but my measurements fluctuate by several Hz. I tried FFT and Autocorrelation in C++ on an older ESP32 with a "only" 20 kHz sampling rate.

My question is: What algorithm would work best in my case? Is an FFT capable of measuring as accurately as I need with such limited hardware power? What hardware is the best? Would a Raspberry Pico with MicroPython be a better option?

Thanks for your help!

6
  • 1
    Using FFTs for this is most probably overkill. See if you can find cheaper alternatives: en.wikipedia.org/wiki/Pitch_detection_algorithm Commented Nov 22, 2023 at 18:03
  • Note musical instruments do not produce pure tones. Most tuners accept plus or minus 10 cents as being "in-tune". At 440Hz that corresponds to 437Hz to 443Hz. So, your fluctuation may not be a measurement problem, but the actual fluctuations of your violin's note. Commented Nov 22, 2023 at 18:16
  • 0.1Hz accuracy requires 5K$+ lab equipment, not a cheap MCU. Also what do you mean by I only need the main frequency of each string, for example, 440 Hz? do you just want to measure the amplitude of purely 440Hz? Commented Nov 22, 2023 at 18:35
  • remember that pitch related to frequency is on a logarithmic scale. Detecting to 0.5 Hz accuracy is not actually a helpful bench mark. 0.5 Hz to 1 Hz is HUGE in pitch terms. 1000.5Hz to 1001Hz is way beyond human hearing. I would first start with an Auto-Correlation algorithm, but you will need to "tidy up" the results. Electronics tuners can be a little clever to make them simple as typically you set what pitch you are aiming for. I would also recommend checking out the music.stackexchange.com for some theoretical insight Commented Nov 22, 2023 at 20:23
  • Fourier transforms that give enough temporal accuracy will be slow but also miss out more transient information. Plus, FFT are on a linear frequency scale so you will get a lot resolution where you do not need it. Commented Nov 22, 2023 at 20:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.