# HG changeset patch # User Chris Cannam # Date 1558018567 -3600 # Node ID 2ef9c5d744ab6543e4670d3ebf3d147eefa8b430 # Parent 475571f398fedbfb7f5fecc1282c49c37fc7b4e6 Couple more parameters diff -r 475571f398fe -r 2ef9c5d744ab src/TuningDifference.cpp --- a/src/TuningDifference.cpp Wed May 15 17:52:47 2019 +0100 +++ b/src/TuningDifference.cpp Thu May 16 15:56:07 2019 +0100 @@ -36,7 +36,8 @@ return pitchToFrequency(69, cents, 440.); } -static float defaultMaxDuration = 0; +static float defaultMaxDuration = 0.f; +static int defaultMaxSemis = 4; TuningDifference::TuningDifference(float inputSampleRate) : Plugin(inputSampleRate), @@ -44,7 +45,8 @@ m_refChroma(new Chromagram(paramsForTuningFrequency(440.))), m_blockSize(0), m_frameCount(0), - m_maxDuration(defaultMaxDuration) + m_maxDuration(defaultMaxDuration), + m_maxSemis(defaultMaxSemis) { } @@ -67,7 +69,6 @@ string TuningDifference::getDescription() const { - // Return something helpful here! return "Estimate the tuning frequency of a recording, by comparing it to another recording of the same music whose tuning frequency is known"; } @@ -143,9 +144,17 @@ desc.unit = "s"; list.push_back(desc); - //!!! parameter: max search range - //!!! parameter: fine search precision - //!!! parameter: max amount of audio to listen to + desc.identifier = "maxrange"; + desc.name = "Maximum range in semitones"; + desc.description = "The maximum difference in semitones that will be searched."; + desc.minValue = 1; + desc.maxValue = 11; + desc.defaultValue = defaultMaxSemis; + desc.isQuantized = true; + desc.quantizeStep = 1; + desc.unit = "semitones"; + list.push_back(desc); + return list; } @@ -410,8 +419,7 @@ { map dists; - int maxSemis = 4; - int maxRotation = (m_bpo * maxSemis) / 12; + int maxRotation = (m_bpo * m_maxSemis) / 12; for (int r = -maxRotation; r <= maxRotation; ++r) { double dist = featureDistance(other, r); diff -r 475571f398fe -r 2ef9c5d744ab src/TuningDifference.h --- a/src/TuningDifference.h Wed May 15 17:52:47 2019 +0100 +++ b/src/TuningDifference.h Thu May 16 15:56:07 2019 +0100 @@ -71,6 +71,7 @@ int m_blockSize; int m_frameCount; float m_maxDuration; + int m_maxSemis; Chromagram::Parameters paramsForTuningFrequency(double hz) const; TFeature computeFeatureFromTotals(const TFeature &totals) const;