#include "tuner.h" #include "audioio.h" #include #include #include using namespace std::chrono_literals; int main(int argc, char* argv[]) { RIT::AudioIO audioIO; RIT::Tuner tuner(audioIO.size(), audioIO.sampleFrequency()); std::cout << "Tuner range: " << tuner.fMin() << " ... " << tuner.fMax() << " Hz" << std::endl; while (true) { std::vector> dataIn = audioIO.sample(); auto start = std::chrono::high_resolution_clock::now(); RIT::Pitch pitch = tuner(dataIn); auto end = std::chrono::high_resolution_clock::now(); std::string name = pitch.name; if (name == "") name = ""; std::cout << "Detected Note: " << name << " Deviation: " << pitch.deviation << " Frequency: " << pitch.f << ", took " << std::chrono::nanoseconds(end - start).count() * 0.000001 << "ms" << std::endl; std::this_thread::sleep_until(start + 100ms); } return 0; }