browser-voice-plugin
v1.1.0
Published
A minimalist voice broadcast library based on javaScript v8
Downloads
2
Maintainers
Readme
browser-voice-plugin
A minimalist speech broadcast library (only 3kb) based on JavaScript V8.
Overall
VoicePlugin supports speaking text in the browser side, as well as the ability to pause, resume, and stop speaking. Currently, VoicePlugin only supports Internet Explorer (based on Sapi.Spvoice library), Chrome, and Firefox (based on SpeechSynthesisUtterance Object).
Options
For IE browser, you can set volume (range: 0.1 ~ 1) and rate (range: 0.1 ~ 10), such as
const options = {
volume: 0.5,
rate: 1
};
const hiSounder = new VoicePlugin(options);
For Chrome and FireFox browser, you can set lang (zh-CN or en-US) and pitch (range: 0 ~ 2), such as:
const options = {
volume: 0.5,
rate: 1,
lang: 'zh-CN',
pitch: 1
};
const hiSounder = new VoicePlugin(options);
Usage
HTML
<script src="../dist/voicePlugin.min.js"></script>
<script type="text/javascript">
const hiSounder = new VoicePlugin();
hiSounder.speak('我爱你,中国');
</script>
CLI
import VoicePlugin from 'browser-voice-plugin';
const hiSounder = new VoicePlugin();
hiSounder.speak('我爱你,中国');
License
Browser-voice-plugin is licensed under a MIT License