How to analyze an audio stream from the mic

How to analyze an audio stream from the mic

BY 03 Apr 2017 Web Application Development

Hi, everybody!

I’m trying to get the frequency information from audio stream from the microphone. I tried the following:

 

if (navigator.webkitGetUserMedia) {
   navigator.webkitGetUserMedia({ audio: true },
      function(stream) {
       alert(stream);
     context = new webkitAudioContext();
     analyser = context.createAnalyser();
         canvas = document.getElementById(‘analyser_render’);
     ctx = canvas.getContext(‘2d’);
     source = context.createMediaStreamSource(stream);
     source.connect(analyser); 
     frameLooper();
      },
      function(err) {
         console.log(“The following error occurred: ” + err.name);
      }
   );
} else {
   console.log(“getUserMedia not supported”);
}

 

Then I found out that the MediaStreamSource interface of Audio API is not supported yet. Are there any other ways to analyze audio from the mic?

Written by