comparison Tuning.cpp @ 80:026a5c0ee2c2 matthiasm-plugin

bins per semitone can now be chosen in chromamethods.h
author Matthias Mauch <mail@matthiasmauch.net>
date Thu, 11 Nov 2010 15:11:05 +0900
parents d398e73b46e0
children 3f104bceac99
comparison
equal deleted inserted replaced
78:d52884de7d79 80:026a5c0ee2c2
185 // 185 //
186 /** Calculate Tuning 186 /** Calculate Tuning
187 calculate tuning from (using the angle of the complex number defined by the 187 calculate tuning from (using the angle of the complex number defined by the
188 cumulative mean real and imag values) 188 cumulative mean real and imag values)
189 **/ 189 **/
190 float meanTuningImag = sinvalue * m_meanTuning1 - sinvalue * m_meanTuning2; 190
191 float meanTuningReal = m_meanTuning0 + cosvalue * m_meanTuning1 + cosvalue * m_meanTuning2; 191 float meanTuningImag = 0;
192 float meanTuningReal = 0;
193 for (int iBPS = 0; iBPS < nBPS; ++iBPS) {
194 meanTuningReal += m_meanTunings[iBPS] * cosvalues[iBPS];
195 meanTuningImag += m_meanTunings[iBPS] * sinvalues[iBPS];
196 }
197
198
192 float cumulativetuning = 440 * pow(2,atan2(meanTuningImag, meanTuningReal)/(24*M_PI)); 199 float cumulativetuning = 440 * pow(2,atan2(meanTuningImag, meanTuningReal)/(24*M_PI));
193 200
194 char buffer0 [50]; 201 char buffer0 [50];
195 202
196 sprintf(buffer0, "%0.1f Hz", cumulativetuning); 203 sprintf(buffer0, "%0.1f Hz", cumulativetuning);