PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

18 lines
535B

  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