Slide 1

Slide 1 text

Talking web apps

Slide 2

Slide 2 text

Orlando Del Aguila

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

@eatcodetravel eatcodetravel.com hashlabs.com

Slide 5

Slide 5 text

Talking web apps

Slide 6

Slide 6 text

Speech Synthesis API Web Speech API

Slide 7

Slide 7 text

Speech Synthesis API Web Speech API

Slide 8

Slide 8 text

Support Speech Synthesis

Slide 9

Slide 9 text

API Speech Synthesis Volume Rate Pitch Language Voice

Slide 10

Slide 10 text

API Speech Synthesis 1 var msg, voices; 2 msg = new SpeechSynthesisUtterance(); 3 voices = window.speechSynthesis.getVoices(); 4 5 // some voices don't support altering params 6 msg.voice = voices[10]; 7 msg.voiceURI = 'native'; 8 msg.volume = 1; // 0 to 1 9 msg.rate = 1; // 0.1 to 10 10 msg.pitch = 2; //0 to 2 11 msg.text = 'Hello World'; 12 msg.lang = 'en-US';

Slide 11

Slide 11 text

API Speech Synthesis 1 var msg, voices; 2 msg = new SpeechSynthesisUtterance(); 3 voices = window.speechSynthesis.getVoices(); 4 5 6 7 8 9 10 11 12 13

Slide 12

Slide 12 text

API Speech Synthesis 4 5 // some voices don't support altering params 6 msg.voice = voices[10]; 7 msg.voiceURI = 'native'; 8 msg.volume = 1; // 0 to 1 9 msg.rate = 1; // 0.1 to 10 10 msg.pitch = 1; //0 to 2 11 msg.text = 'Hello World'; 12 msg.lang = ‘en-US'; 13 speechSynthesis.speak(msg); 1 2 3

Slide 13

Slide 13 text

API Speech Synthesis 1 // speechSynthesis has a queue, 2 // and you don't need to worry about it. 3 speechSynthesis.speak(msg); 4 speechSynthesis.cancel(); 5 speechSynthesis.pause(); 6 speechSynthesis.resume();

Slide 14

Slide 14 text

API Speech Synthesis 1 // SpeechSynthesisUtterance has events 2 var msg = new SpeechSynthesisUtterance(); 3 4 msg.onstart = function onstart() {}; 5 msg.onend = function onend() {}; 6 msg.onerror = function onerror() {}; 7 msg.onpause = function onpause() {}; 8 msg.onboundary = function onboundary() {};

Slide 15

Slide 15 text

Speech Synthesis API DEMO

Slide 16

Slide 16 text

Speech Synthesis API Web Speech API

Slide 17

Slide 17 text

Support Web Speech API

Slide 18

Slide 18 text

API Language Continuous InterimResults Web Speech API

Slide 19

Slide 19 text

API onstart onend onresults onerror Web Speech API

Slide 20

Slide 20 text

API Web Speech API 1 // notice the webkit prefix 2 var recognition; 3 recognition = new webkitSpeechRecognition(); 4 recognition.lang = 'es-VE'; 5 recognition.continuous = true; 6 recognition.interimResults = false; 7 8 // Events 9 recognition.onstart = function () {}; 10 recognition.onend = function () {}; 11 recognition.onresult = function () {}; 12 recognition.onerror = function () {}; 13 recognition.start();

Slide 21

Slide 21 text

API Web Speech API 1 2 3 4 5 6 7 8 9 10 11 12 13 11 recognition.onresult = function () {};

Slide 22

Slide 22 text

API Web Speech API 1 recognition.onresult = function (event) { 2 var length, transcript, msg; 3 length = event.results.length - 1; 4 transcript = event.results[length][0].transcript; 5 transcript = transcript.trim(); 6 7 console.log(transcript); 8 9 msg = new SpeechSynthesisUtterance(message); 10 msg.text = message; 11 window.speechSynthesis.speak(msg); 12 }

Slide 23

Slide 23 text

Web Speech API DEMO

Slide 24

Slide 24 text

Resources

Slide 25

Slide 25 text

Web apps that talk Voice driven apps MDN Web Speech API Web Speech API Spec

Slide 26

Slide 26 text

QA

Slide 27

Slide 27 text

Thanks