Tag: 语音合成

开始在Android和Safari设备上运行SpeechSynthesis API

我正在尝试使用SpeechSynthesis API制作一个Web应用程序,以便在单击开始button后运行我的程序,然后开始在我的Android和iOS设备上收听用户。 用户可以说任何东西来运行程序。 之后,我可以每三秒钟播放audio文件。 以下是我的代码到目前为止。 我的逻辑错了吗? 点击并听到任何声音后,我无法启动我的程序。 另一个问题是这个SpeechSynthesis API可以支持Android和iOS设备,但是当我看到一些事件,比如'soundstart event'时,它不支持Safari Mobile。 他们有什么关系? 我真的很困惑。 SpeechRecognition API只支持Chrome浏览器,但是我不需要像soundstart一样的事件吗? 感谢您的帮助提前。 对此,我真的非常感激。 <p id="msg" align="center"></p> <script> var utterance = new SpeechSynthesisUtterance("Hello"); //window.speechSynthesis.speak(utterance); var supportMsg = document.getElementById('msg'); if ('speechSynthesis' in window) { supportMsg.innerHTML = 'Your browser <strong>supports</strong> speech synthesis.'; console.log("Hi"); utterance.onstart = function(event) { console.log('Hhhh') }; var playList = ["1_hello", "2_how_old", […]

JS语音合成问题在iOS上

我最近实现了一个基于Google TTS URL的基本Web应用程序,可以在前端生成清晰的MP3文件供播放。 这已经受到额外的安全检查,这意味着我不得不更新代码库来使用替代方法。 一个这样的select是javascript的语音合成API,即SpeechSynthesisUtterance()和window.speechSynthesis.speak('…')。 这在我的台式机和笔记本电脑上运行得非常好,但只要我在iOS设备上使用它,audio的速度就会显着加快。 任何人都可以build议我能做些什么来解决这个问题? 见下面的例子代码: var msg = new SpeechSynthesisUtterance(); msg.text = item.title; msg.voice = "Google UK English Male"; msg.rate = 0.7; msg.onend = function(){ console.log('message has ended'); $('.word-img').removeClass('img-isplaying'); }; msg.onerror = function(){ console.log('ERROR WITH SPEECH API'); $('.word-img').removeClass('img-isplaying'); }; window.speechSynthesis.speak(msg);

iOS中的语音输出

是否有可能访问用于可访问性的iOS语音合成function?