GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Vanthink-UED/vanspeak: a plugin for text to speech

BranchesTags
Open more actions menu

Latest commit

 

History

50 Commits
50 Commits

Folders and files

NameName
Last commit message
Last commit date
build
build
 
 
demo
demo
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
README.md
README.md
 
 
gulpfile.js
gulpfile.js
 
 
karma.conf.js
karma.conf.js
 
 
package.json
package.json
 
 

Repository files navigation

vanspeak.js

Build Status

a plugin for text to speech (<=12KB)

快速开始

<script src="./build/vanspeak.min.js"></script>

CDN

<script src="http://s1.vued.vanthink.cn/595def687aad/vanspeak.min.js"></script>

CMD

define(['vanspeak'],function(vanspeak)) {
  //TODO
}

Also support CMD.

vanSpeak.say('Hello wolrd');

流程

    判断浏览器 
       |
  是否支持发音API  -- 否 --> 请求服务器音频,播放音频 
       | 是
使用浏览器进行单词发音

方法

  • say(word,options)

word: 需要读的单词

options: 配置

读出一个单词

vanSpeak.say('hello');

Demo

  • preAudio

预加载音频,仅仅对于不支持 本地发音的浏览器有效果,接受多个单词组成的数组作为参数

vanSpeak.preAudio(['say','this','word']);
  • startHandle

防止iOS设备无法呼醒,iOS(<=9) 需要用户手动触发屏幕后才能进行发音,如果你是自动发音,需要在初始化的时候加入改方法

var btn = document.querySelector('.btn-start');
btn.onclick = function() {
  vanSpeak.startHandle();
};
  • cancel

取消当前的发音

  • setVolume

设置音量大小 @param v(0-1)

初始化配置 Options

key Type Example Description
rate Number 0.7 the speech speed
volume Number 1 speech volume
maxWordNum Number 120 limte the word length
speechStart Function when speech start
speechEnd Function when speech end
speechError Function when speech error

example:

var options = {
  'rate': 0.7,
  'volume': 1,
  // max words num for better experence  so we limit max words 
  'maxWordNum': 100,
  'speechStart': function () {
    console.log('start');
  }
}

vanspeak.say('hello',options);

About

a plugin for text to speech

vanthink-ued.github.io/vanspeak/

Topics

javascriptspeechtext-to-speech

Resources

Readme
Activity
Custom properties

Stars

5 stars

Watchers

4 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.