From 1c3d3f6290a2e06d077e741a79c39e5a241cad29 Mon Sep 17 00:00:00 2001 From: Meet Zaveri Date: Thu, 14 Dec 2017 22:26:08 +0530 Subject: [PATCH] Create Speech_synthesis.md Hey, I think this is the coolest one I found! Hope this snippet gets attraction --- snippets/Speech_synthesis.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 snippets/Speech_synthesis.md diff --git a/snippets/Speech_synthesis.md b/snippets/Speech_synthesis.md new file mode 100644 index 000000000..664decc73 --- /dev/null +++ b/snippets/Speech_synthesis.md @@ -0,0 +1,16 @@ +### Speech synthesis + +Currently The SpeechSynthesisUtterance interface of the Web Speech API represents a speech request. +It contains the content the speech service should read and information about how to read it (e.g. language, pitch and volume.) + +To know more - https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance + +``` +function speak (message) { + var msg = new SpeechSynthesisUtterance(message) + var voices = window.speechSynthesis.getVoices() + msg.voice = voices[0] + window.speechSynthesis.speak(msg) +} +speak('Hello, world') +```