browser-voice-plugin

1.1.0 • Public • Published

browser-voice-plugin

A minimalist speech broadcast library (only 3kb) based on JavaScript V8.

License: MIT

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

References

  1. https://blog.csdn.net/xjl271314/article/details/106220492/
  2. SpeechSynthesisVoice
  3. SpVoice Volume property

/browser-voice-plugin/

    Package Sidebar

    Install

    npm i browser-voice-plugin

    Weekly Downloads

    5

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    20.4 kB

    Total Files

    10

    Last publish

    Collaborators

    • chenxi_liu