# HG changeset patch # User Chris Cannam # Date 1569509087 -3600 # Node ID e6abd6e990511d52b71640358e5ca577abba82ee # Parent 2426f4d30caddfd3cb839bb456a36f419d8a58ea This is not actually a tonic-strength output - it's a key-strength output in which the relative major and minor (which have different tonics but the same key signatures) have been summed into a single bin diff -r 2426f4d30cad -r e6abd6e99051 plugins/KeyDetect.cpp --- a/plugins/KeyDetect.cpp Wed Aug 14 14:53:48 2019 +0100 +++ b/plugins/KeyDetect.cpp Thu Sep 26 15:44:47 2019 +0100 @@ -298,10 +298,10 @@ } list.push_back(d); - d.identifier = "tonicstrength"; - d.name = "Tonic Strength Plot"; + d.identifier = "mergedkeystrength"; + d.name = "Merged Key Strength Plot"; d.unit = ""; - d.description = "Correlation of the chroma vector with stored key profile for each tonic pitch across both major and minor mode"; + d.description = "Correlation of the chroma vector with stored key profile for each key, with major and minor alternatives merged"; d.hasFixedBinCount = true; d.binCount = 12; d.hasKnownExtents = false; @@ -310,9 +310,7 @@ d.binNames.clear(); for (int i = 0; i < 12; ++i) { int idx = conversion[i]; - std::string label = getKeyName(idx > 12 ? idx-12 : idx, - i >= 12, - false); + std::string label = getBothKeyNames(idx > 12 ? idx-12 : idx); d.binNames.push_back(label); } list.push_back(d); @@ -464,3 +462,31 @@ else return base + " major"; } +std::string +KeyDetector::getBothKeyNames(int index) const +{ + // Keys are numbered with 1 => C, 12 => B + + static const char *names[] = { + "C maj / A min", + "Db maj / Bb min", + "D maj / B min", + "Eb maj / C min", + "E maj / C# min", + "F maj / D min", + "F#/Gb maj / Eb/D# min", + "G maj / E min", + "Ab maj / F min", + "A maj / F# min", + "Bb maj / G min", + "B maj / G# min" + }; + + if (index < 1 || index > 12) { + return "(unknown)"; + } + + return names[index - 1]; +} + + diff -r 2426f4d30cad -r e6abd6e99051 plugins/KeyDetect.h --- a/plugins/KeyDetect.h Wed Aug 14 14:53:48 2019 +0100 +++ b/plugins/KeyDetect.h Thu Sep 26 15:44:47 2019 +0100 @@ -60,6 +60,7 @@ GetKeyMode::Config getConfig() const; std::string getKeyName(int index, bool minor, bool includeMajMin) const; + std::string getBothKeyNames(int index) const; GetKeyMode* m_getKeyMode; double* m_inputFrame;