将 HTML5 SpeechSynthesisUtterance 生成的语音记录到文件中 [英] Record HTML5 SpeechSynthesisUtterance generated speech to file

查看:30
本文介绍了将 HTML5 SpeechSynthesisUtterance 生成的语音记录到文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过以下方式使用 Chrome 的语音合成 API(版本 33.0.1750.112 beta-m)从文本生成语音

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);

现在我想将此语音保存在一个文件中(可能使用 WebAudio API).这可能通过一些函数调用吗?

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

我查看了 Speech Synthesis API 中的方法,没有什么可以保存这些语音数据.使用 WebAudio API,我能够在麦克风中捕获此语音,但这会引入很多不必要的噪音.是否无法将这些语音数据保存在 Chrome 浏览器本身中,因为它首先是生成它的?

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?

推荐答案

很遗憾没有.显然没有主要用例,请参阅 this回答

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

但是您可以使用 js TTS 库,例如 mespeak.它输出可以通过网络音频缓冲区节点播放的缓冲区.(虽然发动机听起来不像自然铬).

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).

这篇关于将 HTML5 SpeechSynthesisUtterance 生成的语音记录到文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆