提取基频时,半倍频普遍出现,对此必须做好半倍频规整
inline float normalize_pitch(float pitch, float temp)
{
float half = fabs(pitch - 12 - temp);
float twice = fabs(pitch + 12 - temp);
float self = fabs(pitch - temp);
if (half < twice && half < self)
{
return pitch - 12;
}
else if (twice < half && twice < self)
{
return pitch + 12;
}
}