3 ms·
You wouldn't use an FFT for a guitar tuner, you'd just time zero crossings. I did use an Arduino to detect "key tones" on a wireline radio controller, sampling
by Gordonjcp 4y ago
You wouldn't use an FFT for a guitar tuner, you'd just time zero crossings.
I did use an Arduino to detect "key tones" on a wireline radio controller, sampling at 16kHz (ADC running flat out on one channel) and implementing Goertzel's Method to detect the 2175Hz guard tone and 1950Hz and 1850Hz keying tones, and a twin-T notch filter to remove the 2175Hz tone from the audio. The controller sent a short burst of 2175Hz followed by a short burst of one of the lower tones, to key up the transmitter on the correct channel, then the presence of any audio on the line (including the "low level guard tone", 2175Hz but much quieter) kept the transmitter on until you'd finished speaking.
It was sensitive enough to detect the low-level guard tone even when the audio over it was quite loud.
As far as I can tell, it's been running for a good ten years now and I've never been called back in to fix it.
Edit: just to be clear the notch filter was analogue in the audio path! I did make a similar device to process audio from an RTP stream between devices linking radios that did everything digitally but that required a Raspberry Pi with a massive amount of CPU horsepower and a limitless almost infinite amount of RAM - it used almost 128MB!
- mjochim 4y agoApart from the fact that FFT is way more complex than needed for a guitar tuner, I also believe it’s not even really possible to use a Fourier Transform for a useful guitar tuner. Because you won’t achieve good enough frequency resolution. I would be interested if I am missing any possible tricks here. But the low E string on a guitar is about 82.4 Hz. For a useful basic tuner you would need a precision of maybe 5 cents (~ percent of a semitone), or roughly 0.25 Hz (roughly 1 Hz for the high E string). Frequency resolution with the FFT improves when you analyse a longer signal. For 0.25 Hz resolution, you need more than two seconds of audio. Two seconds where the pitch doesn’t change. I don’t think you’d get anywhere with such a design. I’m not sure if this could be changed with a higher sample rate. With a higher sample rate, you have more samples per second to feed into the FFT, but also the upper boundary for frequency increases, so I believe frequency resolution just stays the same. I’d need to look up the formulas, though. Maybe with extreme zero padding? Or any other tricks?
- kragen 4y ago> good enough frequency resolution phase vocoder, little man
- kragen 4y agos/little man/my friend/ the deprecatory reading was unwarranted
- rcxdude 4y agoIt's possible to interpolate between FFT bins if you're assuming the input is a reasonably pure tone (because a pure tone in between two FFT bins will fill both of them in proportion to how close it is to each of them). This can give you extremely good frequency resolution (and is also good at rejecting noise far away from the tone of interest).
- Gordonjcp 4y agoYou're absolutely right. Even on a bass where your low E is about 40Hz (or a 5-string where you have a low *C* at 32Hz give or take) you'd only need a handful of cycles to track pitch very accurately. The trick works because you're only trying to tune one string at a time. An FFT approach would presumably be able to track the pitch of all the strings regardless of what notes you were playing, with a bit of thought, although if you played an A on the 6th string 5th fret and an open 5th string it wouldn't be able to tell which was "out".