fix: AquesTalk truncates speech on space - use 、 as word separator

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
This commit is contained in:
2026-08-08 15:26:55 +08:00
parent cb22e074af
commit f27bcfb055
+6 -2
View File
@@ -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}`);