Record HTML5 SpeechSynthesisUtterance generated speech to file

老子叫甜甜 提交于 2019-11-30 12:56:05

问题


I am able to generate speech from text using Chrome's Speech Synthesis API (in Version 33.0.1750.112 beta-m) in the following manner

var transcript = document.getElementById("speechTxt").value; 
var msg = new SpeechSynthesisUtterance(transcript); 
speechSynthesis.speak(msg);

Now I want to save this speech in a file (maybe using WebAudio API). Is this possible through some function call?

I have looked at the methods in Speech Synthesis API and there is nothing to save this speech data. Using WebAudio API I am able to capture this speech sound in the microphone but that introduces a lot of unnecessary noise. Is it not possible to save this speech data inside the Chrome browser itself as it is the one which is generating it in the first place?


回答1:


Unforunately no. Apparently there was no major use case, see this answer

But you can use a js TTS library like mespeak. It outputs buffers that can be played back via web audio buffer nodes. (Although the engine it does not sound as natural chrome's).



来源:https://stackoverflow.com/questions/21905583/record-html5-speechsynthesisutterance-generated-speech-to-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!