我开发了包含Google TTS的Google chrome扩展
我用Crossrider重写了它,让它在不同的平台上工作(它工作得很好,直到它到了TTS部分)
代码如下:
function PlayGoogleTTS(EngWord){
voices = speechSynthesis.getVoices();
msg = new SpeechSynthesisUtterance();
msg.volume = 1; // 0 to 1
msg.rate = 10; // 0.1 to 10
msg.pitch = 2; //0 to 2
msg.text = EngWord;
msg.lang = 'en-US';
msg.voice = voices[1];
msg.voice = voices[1]; // Note: some voices don't support altering params
speechSynthesis.speak(msg);
}
// Fetch the list of voices and populate the voice options.
function loadVoices() {
// Fetch the available voices.
var voices = speechSynthesis.getVoices();
}
// Chrome loads voices asynchronously.
window.speechSynthesis.onvoiceschanged = function(e) {
loadVoices();
};那么,我如何转换它,使其在Crossrider上工作?
发布于 2015-01-06 23:19:23
从你的问题中看不出你使用的是哪个speechSynthesis库/api。但是,假设它是基于Chrome's TTS API的,则所需的"tts“权限不可用。
披露:我是一名Crossrider员工
发布于 2015-01-14 18:51:58
它被认为是一种解决办法,而不仅仅是一个答案
我刚刚使用了另一个能够在firefox中生成ogg maves的TTS
https://stackoverflow.com/questions/27775913
复制相似问题