Select and speak (text selection and speech synthesis) - Web based TTS
Installation
npm install select-and-speak
Description
Select (highlight) text in your browser and have it spoken by speech synthesis. Use https://github.com/tom-s/speak-tts for the speech synthesis.
See browser support here : http://caniuse.com/#feat=speech-synthesis
Demo
Usage
Import the component :
import Speech from 'select-and-speak' // es6// var Speech = require //
Start the component :
const speech = new console.log}).catch
// Exemple with confSpeech.init;
The Speech class inherits from the class provided by speak-tts. It means all the methods from speak-tts are available, plus the following:
- setWordwrap(bool)
- setAutospeak(bool)
- speakSelectedText(options = {})
- getSelectedText()
- for the remaining methods please check out https://github.com/tom-s/speak-tts
Set wordwrap :
speech
Set autospeak :
speech
Speak the current selection :
speech // you can add similar options to the ones in speak() from https://github.com/tom-s/speak-tts
Get current text selection :
speech
Tests
These will be added soon. Please do not hesitate to add some !
About the Author
I am a full-stack Javascript developer based in Lyon, France.
License
speech and speak is dual licensed under the MIT license and GPL. For more information click here.