title: In ml5 pitch detection using crepe model, how to detect pitch above ±2kHz
body: <p>I'm successfully using pitch detection features of ml5:</p>
  <ul>
  <li>tutorial: <a href="https://ml5js.org/reference/api-PitchDetection/" rel="nofollow noreferrer">https://ml5js.org/reference/api-PitchDetection/</a></li>
  <li>model: <a href="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models/models/pitch-detection/crepe/" rel="nofollow noreferrer">https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models/models/pitch-detection/crepe/</a></li>
  </ul>
  <h2>The issue:</h2>
  <p>No pitch above ±2000Hz is detected. I tried multiple devices and checked that the sounds are visible on sonograms so it's does not seem to be a mic issue.</p>
  <p>I assumed it may be a result of sampling rate limitations / resampling done by the library, as the Nyquist frequency (max &quot;recordable&quot; frequency) is that of half of the sampling rate.</p>
  <p>I hosted the ml5 sources localy and tried modifying the <a href="https://github.com/ml5js/ml5-library/tree/main/src/PitchDetection" rel="nofollow noreferrer">PitchDetection class</a></p>
  <p>There I see the sampling rate seems to be resampled to 1024Hz for performance reasons. This does not sound right though as if I'm not mistaken, this would only allow detection of frequencies up to 512hz. I am definitely missing something (or a lot).</p>
  <p>I tried fiddling with the rates, but increasing it to, say 2048 causes an error:
  <code>Error when checking : expected crepe_input to have shape [null,1024] but got array with shape [1,2048].</code></p>
  <h2>My question is:</h2>
  <p>Is there something in ml5 <a href="https://github.com/ml5js/ml5-library/tree/main/src/PitchDetection" rel="nofollow noreferrer">PitchDetection class</a> I can modify, configure (perhaps a different model) to detect frequencies higher than 2000Hz using crepe model?</p>