How to use HTML5 Web Audio API for voice recording

I am looking for a way to record my voice and, according to the recorded voice, move the animation left or right.

I heard that HTML5 has an Audio API through which you can record your voice, but I don’t know how to do it.

I will be grateful to everyone who can help me or come up with some solutions, suggestions, code or recommendations to solve this problem.

+5
source share
1 answer

on webkit browsers you can use get the api user interface with webkitGetUserMedia- as shown in html5rocks .
if you want to use your voice to create javascript events (for example, to control objects on the screen), you will have to analyze the incoming sound (for example, high frequency for event1 - low frequency for event2, speech analysis is much more complicated, see below)

alternatively, there is chrome speech recognition "x-webkit-speech" (see the example here ), which will analyze speech on google servers and therefore probably too slow for real-time control.

I do not know the real-time speech analysis in the browser, but would be glad to find (even a very basic) feature.

edit: add some code (adapted from here )

<html>
  <head>
  </head
  <body>
    <input type="search" id="mike" x-webkit-speech>
    <script type="text/javascript">
      var mike = document.getElementById('mike');
      mike.onwebkitspeechchange = function(e) {
        console.log(e); // SpeechInputEvent
        console.log(e.results[0].utterance);
      };
    </script>
  </body>
</html>
+2
source

All Articles