0
$\begingroup$

i am trying to create a program that gets the fundamental frequency of the signal coming from a guitar string to identify what note is being played, is harmonic product spectrum the algorithm the most suitable in getting the fundamental frequency? is there any algorithm to use that can be used real-time?

also i am using matlab simulink to implement this algorithm to arduino

all answers are deeply appreciated, thank you in advance :)

$\endgroup$
  • $\begingroup$ i've done pitch detectors for multiple applications, usually music. if you want this live (which is real-time but also limited in throughput delay to an acceptable delay), i would suggest using AMDF or ASDF or autocorrelation where you are correlating the most current data available to the data a couple milliseconds in the past. i spell out some of the math here and that refers to other SE posts. $\endgroup$ – robert bristow-johnson May 30 '18 at 21:28
  • $\begingroup$ and i don't thin the arduino will have sufficient number-crunching capability for this real-time. but i may be wrong. (i wonder what are the MIPS of a modern arduino? 16 MIPS of an 8-bit processor might end up being as slow as 1 mega-MAC per second. that is too little.) $\endgroup$ – robert bristow-johnson May 30 '18 at 21:38
0
$\begingroup$

HPS (harmonic product spectrum), ASDF, AMDF, and autocorrelation are all similar periodicity estimation methods (they use different weightings and algorithms), which might be useful for guitar note pitch estimation. These methods have different estimation accuracy/error statistics, which may vary depending on the types of guitars, strings, microphone setup, and etc., tested. Experiment.

HPS has one interesting advantage. The overtone series of the lower guitar strings can be slightly inharmonic, partially due to the physics of actual guitar strings, which have non-zero thickness and stiffness. However, there is some experimental evidence that the stretch between the inharmonic overtone series might actually correspond more closely to the typical human psychoacoustic perception of pitch, than the actual fundamental vibration mode frequency of the guitar string.

That said, naive use of these methods may be too heavyweight for an Arduino AVR processor. Perhaps an Arduino using an ARM M0 would be more suitable. Also, to reduce the computational load of doing a full FFT or full autocorrelation-equivalent, you may want to use a modified zero-crossing pitch estimator. Just make sure to use a large enough set of zero crossing span pairs (not just adjacent crossings) so that you can use something like a single AMDF to pick which set of span pairs represent overtone, harmonic or noise lags, and which span pairs might represent fundamental pitch lags. Once you validate your set of span pairs or lags, you may want to average, or median filter.

$\endgroup$
0
$\begingroup$

On the real time aspect , autocorellation performs quite well as only 2 cycles of the fundamental are needed. An open low E string takes approx. 24 millisecs for 2 cycles to occur.. i made a "real time" guitar to midi plug in for my fyp. I tried out various different pitch detection techniques (inc HPS) before settling on autocorrelation.

Heres a vid so you can judge latency:https://youtu.be/1cmOwrOeXCM

Feel free to msg me privately about this as i find this area super interesting!

$\endgroup$
  • $\begingroup$ you can actually correlate a snippet of a cycle against a corresponding snippet of the adjacent cycle. an example is the AXON guitar synth that had a real-time latency of 13 ms, when the low E note of a guitar is 12.1 ms. that's more than 1 cycle but a lot less than 2. $\endgroup$ – robert bristow-johnson Nov 27 '18 at 0:31
  • $\begingroup$ Oh wow that is a neat little trick! Thanks for info! $\endgroup$ – Shutupandplay tuts Dec 24 '18 at 11:05
0
$\begingroup$

I have tried using independent phase-locked loops (more specifically, Costas loops) to track the fundamental and a few partials, and it worked really well. With band-pass filters added to PLL inputs, it can track at least 12 partials.

https://play.google.com/store/apps/details?id=com.igorinov.stringtuner

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.