javascript – Get frequency of Microphone audio in Tone.js Library

I am not sure how to accomplish this. I want to take the incoming microphone audio and display the current frequency detected every second. I am using Tone.js, but the frequency always displays as 0. Here is my javascript so far:

const log = document.getElementById("log");

function toggleMic() {
  const meter = new Tone.Meter();
  const mic = new Tone.UserMedia().connect(meter);;
  setInterval(() => log.innerText = Tone.Frequency().toFrequency(mic), 100);

Read more here: Source link