PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617
  1. % Talkie library
  2. % Copyright 2011 Peter Knight
  3. % This code is released under GPLv2 license.
  4. %
  5. % Home in on best fit pitch
  6. function [pitch,score] = pitchRefine(w,pitchGuess,pitchRange,sampleRate)
  7. score = 0;
  8. phase = (1:length(w))*2*pi/sampleRate;
  9. for (newGuess = pitchGuess-pitchRange:pitchRange/10:pitchGuess+pitchRange)
  10. signal = exp(i*(newGuess*phase))';
  11. pitchScore = abs(mean(w .* signal));
  12. if (pitchScore > score)
  13. score = pitchScore;
  14. pitch = newGuess;
  15. end
  16. end