float YIN::analyze(float *input) { squaredDifference(input); normalizedDifference(); int tau = absoluteThreshold(); if(tau != -1) return 44100.0 / tau; else return tau; }
float Yin::getPitch(float* buffer){ int tauEstimate = -1; float pitchInHertz = -1; //step 2 difference(buffer); // step 3 cumulativeMeanNormalizedDifference(); //step 4 tauEstimate = absoluteThreshold(); //step 5 if(tauEstimate != -1){ pitchInHertz = sampleRate / parabolicInterpolation(tauEstimate); } return pitchInHertz; }