On-screen tuner
Captain's Log: Stardate 77850.6
Today I finished adding an on-screen tuner. This is something that I've wanted for a long time, but always put off because it was easy enough to use e.g. the Ableton tuner or even my guitar tuner app on my phone, etc. But both of these solutions are somewhat annoying in different ways.
I really did not want to become an expert on pitch estimation algorithms, so I researched a bunch of libraries that provide pitch estimation and systematically went through and evaluated them. One annoying factor was that over half of the libraries out there, especially the ones written by academics, used the GPL3 license, which means they're a no-go for a commercial project such as mine. (This is fairly annoying because I'd guess many of academics didn't realize they were hugely restricting who could use their sample code.)
That said, most of the academic pitch estimation code is total shit, so it wasn't the biggest loss. I'm sure the algorithms are amazing, but calling malloc() 8 times per sample buffer when it could very easily be avoided is just stupid.
In the remaining group of actually free -licensed code (MIT / BSD mostly), a lot of it was also total shit. There are a bunch of projects that are evidently hobbyists who had fun implementing pitch estimation papers. Which is fun, but also not useful.
Some of the projects that looked sort-of OK just didn't work. The best MIT-licensed pYIN estimator I found was unable to detect frequencies above about 2.7 kHz (and that was after a bunch of tweaking).
Anyway, I finally settled on https://github.com/cycfi/q. It's well-implemented, easy to use, has a good cmake configuration, and best of all, their pitch estimator works extremely well. It's super fast and stable.
Here's what the tuner looks like.