I have implemented Yin Algorithm to detect pitch.
My issue is with the Performance of Difference Function(Equation 6)
Difference Function:
static std::vector<double> difference(const std::vector<double> &data)
{
int index, tau;
double delta;
int yin_buffer_size = signed(data.size() / 2);
std::vector<double> yin_buffer(yin_buffer_size, 0.0);
for (tau = 1; tau < yin_buffer_size; tau++) {
for (index = 0; index < yin_buffer_size; index++) {
delta = data[index] - data[index + tau];
yin_buffer[tau] += delta * delta;
}
}
return yin_buffer;
}
where data
contains the audio data for a specific window size.
As you can see this function gets slower as you increase the data size(window size).
Please let me know if there is an alternative to the Difference Function which is faster. I want to move ahead in the right direction.
I'm quite new to signal processing, Your help is greatly appreciated.