一个好的文本转语音 JavaScript 库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11279291/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
A good Text-to-Speech JavaScript library
提问by Ajax3.14
I am looking for a good text to speech javascript library for my application. I looked around and saw Jtalkand speak.js. But I'm not sure which one to go forth with. I'm curious to know from people about the pros and cons of them and I'm interested to know if there's any other Javascript plugin you guys came across.
我正在为我的应用程序寻找一个好的文本到语音 javascript 库。我环顾四周,看到了Jtalk和speak.js。但我不确定该选择哪一个。我很想从人们那里了解它们的优缺点,我很想知道你们是否遇到过任何其他 Javascript 插件。
I am basically visualizing a animation and I wanted to add some audio for sight-impaired people to tell them what is happening.
我基本上是在可视化一个动画,我想为视障人士添加一些音频来告诉他们发生了什么。
采纳答案by Frank Visaggio
Well I suggest you use JTtalk. It depends what your target crowd is, because legally blind and what you may think is blind can differ and not everyone knows Braille. The benefits I saw of Jtalk really relied on the examples it had, and how well they worked. To do our entire front-end part of the project with JTalk only took us 2 days, because we pretty much just edited the examples it had. Speak.js had a more difficult learning curve in my/my group's opinion. However, we found that the speech was a bit slurred and had comprehension issues, especially for documents where there were a lot of names (example stock articles mentioning companies). This is why we moved to Braille.
那么我建议你使用JTtalk。这取决于你的目标人群是什么,因为法律上的盲人和你可能认为的盲人是不同的,并不是每个人都知道盲文。我从 Jtalk 中看到的好处真正依赖于它拥有的示例以及它们的工作情况。使用 JTalk 完成整个项目的前端部分只花了我们 2 天的时间,因为我们几乎只是编辑了它的示例。在我/我的团队看来,Speak.js 的学习曲线更加困难。但是,我们发现演讲有点含糊,并且存在理解问题,尤其是对于名称很多的文档(例如提及公司的股票文章)。这就是我们搬到盲文的原因。
My senior design project was for the blind, however we realized that the text to speech wasn't where we wanted to go because we felt Braille was better. With Braille you can multitask better, easily go back and pause and most blind people can read Braille a lot faster then they can listen.
我的高级设计项目是为盲人设计的,但是我们意识到文本到语音不是我们想要的地方,因为我们觉得盲文更好。使用盲文,您可以更好地同时处理多项任务,轻松返回和暂停,大多数盲人阅读盲文的速度比他们听的快得多。
回答by Trinh Hoang Nhu
UPDATE 2018
2018 年更新
Modern browser has built in TTS
现代浏览器已内置 TTS
if ('speechSynthesis' in window) {
var msg = new SpeechSynthesisUtterance('Hello World');
window.speechSynthesis.speak(msg);
}
speechSynthesis
语音合成
Deprecated
已弃用
If you don't want to write a lot of code (or import some library that you don't understand), I suggest you use Google TTS services. It's quite simple. For example you have a text like: welcome to Stack overflow
you can call like this:
如果你不想写很多代码(或者导入一些你不理解的库),我建议你使用谷歌TTS服务。这很简单。例如,您有这样的文字:welcome to Stack overflow
您可以这样调用:
http://translate.google.com/translate_tts?ie=UTF-8&q=Welcome%20to%20stack%20overflow&tl=en&total=1&idx=0&textlen=23&prev=input
This will return an audio file reading that text. Then your job is to use browser audio to play it. Nice and easy.
这将返回读取该文本的音频文件。那么你的工作就是使用浏览器音频来播放它。好,易于。
PS: Google TTS has really true voice.
PS:Google TTS 的声音真的很真实。
Example: http://jsfiddle.net/qspcL/
示例:http: //jsfiddle.net/qspcL/
Reference from: http://jnjnjn.com/187/playing-audio-on-the-ipad-with-html5-and-javascript/
参考自:http: //jnjnjn.com/187/playing-audio-on-the-ipad-with-html5-and-javascript/