在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):hiddentao/google-tts开源软件地址(OpenSource Url):https://github.com/hiddentao/google-tts开源编程语言(OpenSource Language):JavaScript 98.1%开源软件介绍(OpenSource Introduction):Google TTSA Javascript API for the Google's text-to-Speech engine and is based on code at http://weston.ruter.net/projects/google-tts/. NOTE: Playbackwill only work when running the script locally as Google's server only returns audio if you can prevent the browser from sending the Referrer HTTP Header to their server. So this library is at the moment only really good for use in browser plugins and Phonegap apps. Features
InstallationAdd the following inside your HTML
You can also install using bower:
APInew GoogleTTS(language)Initialize a new instance of the library, e.g:
Params:
.languages()Get the full list of supported languages. Returns: An object such as:
.url(text, language)Construct the URL to fetch the speech audio for given text and language. Params:
Returns: a URL to the audio file. .play(text, language, cb)Fetch and play the speech audio for given text and language, if possible (see top). Params:
.getPlayer(cb)Get the active playback mechanism (see below). Params:
.addPlayer(player)Add a playback mechanism (see below). Params:
Playback mechanismsAt the moment there are two supported playback mechanisms:
When you first call Each playback mechanism is implemented as a sub-class of DemoFor browsers which support HTML5 Audio MP3 playback (e.g. Firefox) you can launch For browsers which need to use the SoundManager2 Flash player (e.g. Chrome) there is at the moment no way of getting it work without running a local dev server which serves up the files. This is necessary so that the flash player works, yet it means that the request to Google's servers will be rejected because of the HTTP referrer header. If you would still like to try then run the following:
Build and TestIf you make changes, before you raise a pull request build the project:
LicenseMIT - see LICENSE.md |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论