Mercurial > hg > qm-vamp-plugins
comparison plugins/KeyDetect.cpp @ 251:73c9922fb649
Remove "rapid" option again. It changes the results completely in a way that only makes any sense if the only thing we're doing with it is taking the overall modal key
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Fri, 17 Jan 2020 10:59:04 +0000 |
parents | e6abd6e99051 |
children |
comparison
equal
deleted
inserted
replaced
250:51051baccab6 | 251:73c9922fb649 |
---|---|
30 Plugin(inputSampleRate), | 30 Plugin(inputSampleRate), |
31 m_stepSize(0), | 31 m_stepSize(0), |
32 m_blockSize(0), | 32 m_blockSize(0), |
33 m_tuningFrequency(440), | 33 m_tuningFrequency(440), |
34 m_length(10), | 34 m_length(10), |
35 m_rapid(true), | |
36 m_getKeyMode(0), | 35 m_getKeyMode(0), |
37 m_inputFrame(0), | 36 m_inputFrame(0), |
38 m_prevKey(-1) | 37 m_prevKey(-1) |
39 { | 38 { |
40 } | 39 } |
108 desc.defaultValue = 10; | 107 desc.defaultValue = 10; |
109 desc.isQuantized = true; | 108 desc.isQuantized = true; |
110 desc.quantizeStep = 1; | 109 desc.quantizeStep = 1; |
111 list.push_back(desc); | 110 list.push_back(desc); |
112 | 111 |
113 desc.identifier = "rapid"; | |
114 desc.name = "Rapid"; | |
115 desc.unit = ""; | |
116 desc.description = "Sample intervals without overlap, for speed"; | |
117 desc.minValue = 0; | |
118 desc.maxValue = 1; | |
119 desc.defaultValue = 1; | |
120 desc.isQuantized = true; | |
121 desc.quantizeStep = 1; | |
122 list.push_back(desc); | |
123 | |
124 return list; | 112 return list; |
125 } | 113 } |
126 | 114 |
127 float | 115 float |
128 KeyDetector::getParameter(std::string param) const | 116 KeyDetector::getParameter(std::string param) const |
130 if (param == "tuning") { | 118 if (param == "tuning") { |
131 return m_tuningFrequency; | 119 return m_tuningFrequency; |
132 } | 120 } |
133 if (param == "length") { | 121 if (param == "length") { |
134 return float(m_length); | 122 return float(m_length); |
135 } | |
136 if (param == "rapid") { | |
137 return m_rapid ? 1.f : 0.f; | |
138 } | 123 } |
139 std::cerr << "WARNING: KeyDetector::getParameter: unknown parameter \"" | 124 std::cerr << "WARNING: KeyDetector::getParameter: unknown parameter \"" |
140 << param << "\"" << std::endl; | 125 << param << "\"" << std::endl; |
141 return 0.0; | 126 return 0.0; |
142 } | 127 } |
146 { | 131 { |
147 if (param == "tuning") { | 132 if (param == "tuning") { |
148 m_tuningFrequency = value; | 133 m_tuningFrequency = value; |
149 } else if (param == "length") { | 134 } else if (param == "length") { |
150 m_length = int(value + 0.1); | 135 m_length = int(value + 0.1); |
151 } else if (param == "rapid") { | |
152 m_rapid = (value > 0.5); | |
153 } else { | 136 } else { |
154 std::cerr << "WARNING: KeyDetector::setParameter: unknown parameter \"" | 137 std::cerr << "WARNING: KeyDetector::setParameter: unknown parameter \"" |
155 << param << "\"" << std::endl; | 138 << param << "\"" << std::endl; |
156 } | 139 } |
157 | 140 |
164 KeyDetector::getConfig() const | 147 KeyDetector::getConfig() const |
165 { | 148 { |
166 GetKeyMode::Config config(m_inputSampleRate, m_tuningFrequency); | 149 GetKeyMode::Config config(m_inputSampleRate, m_tuningFrequency); |
167 config.hpcpAverage = m_length; | 150 config.hpcpAverage = m_length; |
168 config.medianAverage = m_length; | 151 config.medianAverage = m_length; |
169 config.frameOverlapFactor = (m_rapid ? 1 : 8); | 152 config.frameOverlapFactor = 1; |
170 config.decimationFactor = 8; | 153 config.decimationFactor = 8; |
171 return config; | 154 return config; |
172 } | 155 } |
173 | 156 |
174 bool | 157 bool |