Crossrider中的Google TTS

时间:2015-01-05 08:40:50

标签: google-chrome-extension cross-browser crossrider

我开发了包含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?

2 个答案:

答案 0 :(得分:2)

从您的问题中不清楚您使用的是哪个speechSynthesis library / api。但是,假设它基于Chrome's TTS API,则需要" tts"许可不可用。

[披露:我是Crossrider员工]

答案 1 :(得分:0)

它被认为是解决方法而不是答案

刚刚使用了另一个能够在firefox中生成ogg maves的TTS