# HG changeset patch # User Chris Cannam # Date 1565889526 -3600 # Node ID 286bd8bb13ccc690af09ffe7e659e5bf52886807 # Parent e4d92aaa689c32bacd7b2663d827eef954f5d348 Record relative pitch in alignment model for display diff -r e4d92aaa689c -r 286bd8bb13cc framework/Align.cpp --- a/framework/Align.cpp Wed Aug 14 13:55:12 2019 +0100 +++ b/framework/Align.cpp Thu Aug 15 18:18:46 2019 +0100 @@ -408,10 +408,19 @@ transform.setParameter("minfreq", 250); // transform.setParameter("usechroma", 1); + int cents = 0; + if (tuningFrequency != 0.f) { transform.setParameter("freq2", tuningFrequency); + + double centsOffset = 0.f; + int pitch = Pitch::getPitchForFrequency(tuningFrequency, ¢sOffset); + cents = int(round((pitch - 69) * 100 + centsOffset)); + SVCERR << "frequency " << tuningFrequency << " yields cents offset " << centsOffset << " and pitch " << pitch << " -> cents " << cents << endl; } + alignmentModel->setRelativePitch(cents); + SVDEBUG << "Align::alignModel: Alignment transform step size " << transform.getStepSize() << ", block size " << transform.getBlockSize() << endl; ModelTransformerFactory *mtf = ModelTransformerFactory::getInstance();