From 0fd431d2bc5bc2608e76dea59d92277b65cd8960 Mon Sep 17 00:00:00 2001 From: guilevi Date: Tue, 6 Apr 2021 12:46:11 +0200 Subject: [PATCH] Fix ESpeak to use Stdin instead of a shell argument --- modules/welcomer/index.js | 2 +- tts/espeak/index.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/welcomer/index.js b/modules/welcomer/index.js index 684aba2..e3ba7d0 100644 --- a/modules/welcomer/index.js +++ b/modules/welcomer/index.js @@ -5,6 +5,6 @@ module.exports = function(bot, api) { const channel = await bot.channels.fetch(process.env.CHANNEL); await api.joinChannel(channel); - api.speak(channel, `Hi! I'm alive. It is now ${new Date().toLocaleTimeString()} on ${new Date().toLocaleDateString()}`,api.ttsEngines.watson); + api.speak(channel, `Hi! I'm alive. It is now ${new Date().toLocaleTimeString()} on ${new Date().toLocaleDateString()}`,api.ttsEngines.espeak, "en"); }) } \ No newline at end of file diff --git a/tts/espeak/index.js b/tts/espeak/index.js index ca4acb2..9ff980c 100644 --- a/tts/espeak/index.js +++ b/tts/espeak/index.js @@ -6,6 +6,7 @@ module.exports=class extends BaseEngine { super('ESpeak','wav') } async getSpeechFile(text, filepath, voice='en', params={}) { - await spawn('espeak', ['-v', voice, '-w',filepath, text]); + let proc=await spawn('espeak', ['-v', voice, '-w',filepath, '--stdin']); + proc.stdin.end(text); } } \ No newline at end of file