baidu-speech-synthesizer
0.2.1 • Public • Published baidu-speech-synthesizer

Play sound from text in browser using Baidu TTS Service
Usage
import BDSSpeechSynthesizer from 'baidu-speech-synthesizer'
let bss = new BDSSpeechSynthesizer()
let speaker = bss.speak('hello world')
speaker.on('ended', () => bss.speak('bye world'))
Quick Start
<script src="https://unpkg.com/baidu-speech-synthesizer@latest/dist/index.min.js"></script>
<script>
var bss = new BDSSpeechSynthesizer();
bss.speak('hello world');
</script>
API
new BDSSpeechSynthesizer()
Creates a new BDSSpeechSynthesizer
instance.
.speak(text[, speechOptions[, playerOptions]])
Play the sound of text, return the speaker.
- text:
String
text to be speak.
- speechOptions:
Object
optional
Speech synthesizer Config.
- playerOptions:
Object
optional
Player Config.
- autoplay:
boolean
Play the sound right now, Defaults true
.
.stop()
Stop the player of this instance.
Versions
Version | Downloads (Last 7 Days) | Tag |
---|
0.2.1 | 1 | latest |
Version History
Version | Downloads (Last 7 Days) | Published |
---|
0.2.1 | 1 | |
0.2.0 | 0 | |
0.1.0 | 0 | |
0.0.2 | 0 | |
Package Sidebar
Install
npm i baidu-speech-synthesizer
Weekly Downloads