Update and rename Speech_synthesis.md to speech_synthesis-(experimental).md

This commit is contained in:
Angelos Chalaris
2017-12-14 20:47:23 +02:00
committed by GitHub
parent d2917bf120
commit c5ccd1befb
2 changed files with 15 additions and 15 deletions

View File

@ -1,15 +0,0 @@
### 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
```
const speak = message => {
const msg = new SpeechSynthesisUtterance(message);
msg.voice = window.speechSynthesis.getVoices()[0];
window.speechSynthesis.speak(msg);
}
speak('Hello, World')
```

View File

@ -0,0 +1,15 @@
### Speech synthesis (experimental)
Use `SpeechSynthesisUtterance.voice` and `indow.speechSynthesis.getVoices()` to convert a message to speech.
Use `window.speechSynthesis.speak()` to play the message.
Learn more about the [SpeechSynthesisUtterance interface of the Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance).
```js
const speak = message => {
const msg = new SpeechSynthesisUtterance(message);
msg.voice = window.speechSynthesis.getVoices()[0];
window.speechSynthesis.speak(msg);
}
// speak('Hello, World') -> plays the message
```