4 ms·
We made the first guitar tuner on a mobile phone in 2006 using the algorithm. It ran like a champ on the Motorola Razr and other ‘dumb phones’ of that time. W
by MobileVet 7y ago
We made the first guitar tuner on a mobile phone in 2006 using the algorithm. It ran like a champ on the Motorola Razr and other ‘dumb phones’ of that time. We charged $25 for it and people loved it as it performed way better than the $25 stand alone tuners. My testing showed it was equivalent to a ~$75 model at the time.
I had a background in signals and controls and was familiar with the DFT. Goertzel was a new variant to me but ran much better on the limited resources.
Good memories.
- jcims 7y agoDo you recall how you handled low/high tuning? Multiple filters?
- pierrec 7y agoI suppose that made sense because of the very limited resources, but note that it's not ideal because it doesn't estimate pitch at all, it only tells you if there's any content inside a frequency bin you provide. A guitar tuner is expected to have an arrow pointing up/down to tell you which way you should adjust, and this algorithm can't give you that. Getting the direction of that arrow accurately can be challenging because of harmonic content (which guitars have a lot of). These days it would make more sense to use an algorithm that takes harmonics into account and gives you an estimated fundamental frequency, like Miller Puckette's pitch detection algorithm.
- kragen 7y agoThis is true. Without reaching for state-of-the-art psychoacoustics research, though, even the second autocorrelation peak will take harmonics into account. And you can compute it without the STFT latency, which matters here. It is possible to estimate where a signal is inside the frequency bin; that's how phase vocoders work.
- CamperBob2 7y agoCouple of ways to do it. If you don't want to deal with the latency required to take the block-to-block phase difference (which somehow ended up with the $50 nomenclature "phase vocoder"), you can just do a parabolic fit on the magnitudes of the central bin and its adjacent pair. 99% of the time, the latter is sufficient. With only three points the math is super trivial [1]. For sharp/flat indication, I'd be inclined to look at the adjacent-bin magnitudes. But it's been explained to me numerous times that tuning an instrument isn't just a matter of measuring its frequency, and while I can't argue with that, I don't think I'm ever going to truly grok it. 1: https://ccrma.stanford.edu/~jos/sasp/Quadratic_Interpolation_Spectral_Peaks.html https://ccrma.stanford.edu/~jos/sasp/Quadratic_Interpolation...
- kragen 7y agoMaybe that does give you less latency (if it doesn't require narrower bins for equivalently good results), but it also requires you to compute three frequency bins, which requires 3× the computation with Goertzel (or Minsky), though still far less than a full autocorrelation function. An amusing thought, which surely JOS has explored: if you use a Karplus–Strong delay line as your resonating element instead of a sinusoid, you can take the overtones into account for free. Maybe that reduces to the ACF, minus some kind of normalization. I'm not sure.
- jacquesm 7y ago> But it's been explained to me numerous times that tuning an instrument isn't just a matter of measuring its frequency, and while I can't argue with that, I don't think I'm ever going to truly grok it. It depends on the instrument. If the instrument has only a few , single physical elements per tone generated and the instrument is frequently tuned then you are correct (say a guitar), there is nothing to be done beyond setting the center frequency correctly depending on how you want to tune. But tuning a piano or harpsichord is a different matter. First of all, there are many different ways of tuning, for instance there is 'stretch' tuning which deals with inharmonicity (sp?) in the higher regions. It gets more complex when you have multiple physical resonating elements (such as strings), for instance depending on where you are on the piano keyboard you might have one, two or three strings per note called a 'unison' (sound together). The strings in a single unison not only need to sound good right after tuning, they need to continue to sound good together afterwards and that means that all of them need to degrade gracefully over time as well and that in turn means that they need to lower in tension in a similar way. Good tuners are able to ensure that the string tension is distributed equally between the 'sounding' part of the string (the middle part) and the non-sounding parts (the ends). The amount of tension on the strings and the friction of the pin block and the pins (stick slip) can make this a lot harder than you might think. Finally, just turning the pins until the frequency matches is going to result in a piano that de-tunes very quickly, the best approach is to go a bit too high and then to slowly lower the pitch while hitting the keys quite hard so that the tension of the string gets distributed evenly. Added complexity is that the combined 18,000 KG of tension on the frame will cause the tuning of one section of the strings to affect all the others. If a piano is off very far from being properly tuned you may have to make multiple passes to get the job done.