-
Notifications
You must be signed in to change notification settings - Fork 576
Description
Hi,
the difference function in the compute method goes out of range, by looking at the code it seems it couldn't do otherwise, the difference function is based on the _yin vector which is resized as _frameSize/2+1, the '+1' is what cause the error.
If I understand correctly the frameSize is equal to the signal or at least in my case I always use a pcm buffer(is this the signal?) of 1024 samples so that's what I use to set signal and frameSize.
this check in PitchYin compute also suggest that:
throw EssentiaException("PitchYin: Unexpected frame size of the input signal frame: ", signal.size(), " instead of ", _frameSize);
pitchyin.cpp line 89
// Compute difference function
for (int tau=1; tau < (int) _yin.size(); ++tau) {
_yin[tau] = 0.;
for (int j=0; j < (int) _yin.size(); ++j) {
_yin[tau] += pow(signal[j] - signal[j+tau], 2);
}
}
another note regarding the difference function is it seems to skip the first sample(tau=1), why does it do that?
I'm a bit confused about why this function as many other can take a parameter which is either overrided or not accepted, wouldn't make sense to don't expose the parameter in the configure and just use what ever is passed to the compute? In this case is the frameSize which must be equal to the signal size,
below is another example in PitchYinFFT
if ((int)spectrum.size() != _frameSize/2+1) {//_sqrMag.size()/2+1) {
Algorithm::configure( "frameSize", int(2*(spectrum.size()-1)) );
}