从网址播放声音-Node.JS(Google-TTS)

时间:2020-03-01 15:51:14

标签: javascript node.js google-api node-modules text-to-speech

我正在尝试在Node.JS中使用Google文本语音API。我正在使用google-tts-api生成api链接,现在想播放它们。是否有任何节点库可以播放来自Weblink的声音?

var tts = require("google-tts-api");
tts(text, "de-DE", 1).then(function(url) {
  playSound(url);
});
function playSound(url) {
  //Some code, that is able to play the audio from the url.
}

1 个答案:

答案 0 :(得分:0)

如果仅需要URL,则可以尝试将ffplay作为子进程来调用。 但是,如果您只是想与节点对话,请尝试say.jstts。如果获得原始音频(通过解码原始PCM音频),则可以使用node-speaker

相关问题