From f27bcfb055b6d76f52c6a2e6a2e1a00088dd6401 Mon Sep 17 00:00:00 2001 From: Chun_Qiu Date: Sat, 8 Aug 2026 15:26:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20AquesTalk=20truncates=20speech=20on=20sp?= =?UTF-8?q?ace=20-=20use=20=E3=80=81=20as=20word=20separator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: AquesTalk_Synthe silently drops all text after a space. English segments previously joined with spaces (word gap), so anything after the first space was silent. Replace all spaces with 、 (Japanese comma pause) which AquesTalk supports natively. - PUNCT_MAP maps space -> 、 - convertEnglishSegment joins words with 、 - synthesize collapses consecutive pauses, strips residual spaces Verified: 'Actually这个proposal是非常creative的' WAV 19316 -> 79196 bytes --- tts_bridge.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tts_bridge.js b/tts_bridge.js index bf5764c..22db2c3 100644 --- a/tts_bridge.js +++ b/tts_bridge.js @@ -192,6 +192,7 @@ function spellWord(word) { const PUNCT_MAP = { ",": "、", ".": "。", "!": "!", "?": "?", ",": "、", "。": "。", "!": "!", "?": "?", + " ": "、", // AquesTalk truncates on space; use 、 pause instead }; function wordToKana(word) { @@ -227,7 +228,7 @@ function convertEnglishSegment(text) { for (const token of words) { if (/^\s+$/.test(token)) { - parts.push(" "); // keep word gap for AquesTalk pause + parts.push("、"); // word gap: AquesTalk truncates on space, use 、 instead continue; } if (PUNCT_MAP[token] !== undefined) { @@ -237,7 +238,7 @@ function convertEnglishSegment(text) { parts.push(wordToKana(token)); } - return parts.join("").replace(/ +/g, " "); + return parts.join("").replace(/、+/g, "、"); } function synthesize(kanaText) { @@ -265,6 +266,9 @@ function synthesize(kanaText) { result += convertEnglishSegment(englishBuf); } + // Collapse consecutive pauses; strip any residual spaces (AquesTalk truncates on space) + result = result.replace(/ +/g, "、").replace(/、+/g, "、").replace(/^、|、$/g, ""); + console.error(`[bridge] SYNTH IN: ${trimmed}`); console.error(`[bridge] SYNTH OUT: ${result}`);