From ec33cf6c19716dee07ad7a9c290c6b44c64e23c7 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Thu, 14 Dec 2017 20:49:06 +0200 Subject: [PATCH] Tag and build --- README.md | 22 ++++++++++++++++++++++ tag_database | 1 + 2 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 6c3c68b31..3f3da1a6b 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,9 @@ * [Powerset](#powerset) * [Standard deviation](#standard-deviation) +### Media +* [Speech_synthesis (experimental)](#speech_synthesis-experimental) + ### Object * [Object from key value pairs](#object-from-key-value-pairs) * [Object to key value pairs](#object-to-key-value-pairs) @@ -812,6 +815,25 @@ const standardDeviation = (arr, usePopulation = false) => { // standardDeviation([10,2,38,23,38,23,21], true) -> 12.29899614287479 (population) ``` +[⬆ back to top](#table-of-contents) +## Media + +### 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 +``` + [⬆ back to top](#table-of-contents) ## Object diff --git a/tag_database b/tag_database index a8d4fa8dd..01c21bce9 100644 --- a/tag_database +++ b/tag_database @@ -68,6 +68,7 @@ shuffle-array:array similarity-between-arrays:array sleep:function sort-characters-in-string-(alphabetical):string +speech_synthesis-(experimental):media standard-deviation:math sum-of-array-of-numbers:array swap-values-of-two-variables:utility