问题
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