From 84e52d65485986499d0f50f5a53286eba3430d41 Mon Sep 17 00:00:00 2001 From: chipsnet Date: Wed, 16 Feb 2022 10:17:56 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Softalk=E3=81=A0=E3=81=A8?= =?UTF-8?q?=E3=81=86=E3=81=BE=E3=81=8F=E5=86=8D=E7=94=9F=E5=87=A6=E7=90=86?= =?UTF-8?q?=E3=81=8C=E5=91=BC=E3=81=B0=E3=82=8C=E3=81=AA=E3=81=84=20Fixes?= =?UTF-8?q?=20#37?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- softalk.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/softalk.js b/softalk.js index 428abbe..e99c6c7 100644 --- a/softalk.js +++ b/softalk.js @@ -1,5 +1,5 @@ const fs = require('fs'); -const { execFileSync } = require('child_process'); +const { execFile } = require('child_process'); const chokidar = require('chokidar'); const Encoding = require('encoding-japanese'); @@ -19,27 +19,23 @@ module.exports = class { toString(bytes) { return Encoding.convert(bytes, { - from: 'SJIS', - to: 'UNICODE', - type: 'string', + from: 'SJIS', + to: 'UNICODE', + type: 'string', }); } async createVoice(message) { this.log.debug("🎤 Softalkで音声を生成します:", message); - execFileSync("./softalk/SofTalk.exe", ["/NM:女性01", `/R:${__dirname}\\voice.wav`, "/T:0", "/X:1", "/V:100", `/W:${message}`], { encoding: "Shift_JIS" }, (error, stdout, stderr) => { - log.debug("execfile 終了") + execFile(`${__dirname}/softalk/SofTalk.exe`, ["/NM:女性01", `/R:${__dirname}\\voice.wav`, "/T:0", "/X:1", "/V:100", `/W:${message}`], { shell: true }, (error, stdout, stderr) => { if (error) { - log.error("An error occurred while running Softalk.\n" + toString(stderr)); - if (readMessages.length) { - canReadMessage = true; - } else { - softalk(); - } + this.log.error(error); return; } - }) + }); + + this.log.debug("📌 音声生成コマンドを実行しました") let waitVoiceCreate = new Promise((resolve, reject) => { let watcher = chokidar.watch('./voice.wav');