0.0.2 • Published 5 years ago

text2speech-js v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

Text2Speech JS

Wrapper around browser Text to Speech API

Note: This package use HTML5 Web Speech API. So, make sure your browser is supported. Please take a look here to see all the supported browser Can I Use Speech Synthesis

Example

Check out this link Text to Speech Example

Installation

Install using one of these method below

yarn add text2speech-js

# or

npm install text2speech-js

Then you can import it using this way:

const Text2Speech = require('text2speech-js')

// or

import Text2Speech from 'text2speech-js'

You can also attach directly to your HTML file by using this way:

<script src="https://rawcdn.githack.com/jefrydco/text2speech-js/master/dist/index.umd.min.js"></script>

Usage

const tts = new TextToSpeech()
tts.text = "Hello World!"

// Speak
tts.speak()

// Pause
tts.pause()

// Resume
tts.resume()

// Stop
tts.stop()

Options

See all the available config here: SpeechSynthesisUtterance Properties

License

MIT Copyright (c) 2019 - Jefry Dewangga(@jefrydco)