text2speech-js

0.0.2 • Public • Published

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)

Package Sidebar

Install

npm i text2speech-js

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

12.7 kB

Total Files

9

Last publish

Collaborators

  • jefrydco