0.2.1 • Published 9 years ago
baidu-speech-synthesizer v0.2.1
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:
Stringtext to be speak. - speechOptions:
ObjectoptionalSpeech synthesizer Config. - playerOptions:
ObjectoptionalPlayer Config.- autoplay:
booleanPlay the sound right now, Defaultstrue.
- autoplay:
.stop()
Stop the player of this instance.