Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Web Speech API

Web Speech API

Avatar for Pascal Helfenstein

Pascal Helfenstein

March 04, 2015
Tweet

More Decks by Pascal Helfenstein

Other Decks in Programming

Transcript

  1. How does it speak? var msg = new SpeechSynthesisUtterance('Hello World');

    // Config (optional) msg.voice = 'Google UK English Male'; msg.volume = 1; // 0 <-> 1 msg.rate = 1.5; // 0 <-> 1 msg.pitch = 1; // 0 <-> 2 speechSynthesis.speak(msg);
  2. How does it listen? var recognition = new webkitSpeechRecognition(); //

    Config (optional) recognition.lang = "en-US"; // "de-DE", "en-IN" recognition.continuous = true; recognition.interimResults = true; recognition.addEventListener('result', function(event) { console.log(event.results[0][0].transcript); // "whats the time" console.log(event.results[0][0].confidence); // 0.93414807319641 }); recognition.addEventListener('end', function(event) { // Start your action }); recognition.start();
  3. What to look out for • interactivity requires SSL… •

    synthesising long texts breaks it • it’s not good in noisy environments