fix: collapse AquesTalk1-unsupported punctuation (!「」・ ) to 、 pause
Probe results: AquesTalk1 rejects U+FF01 !, U+300C/D 「」, U+30FB ・,
U+3000 full-width space with error 105; only 、。?〜ー are safe.
User templates containing ! (e.g. 卧槽!、是{uname}!...) now render
correctly: synthesize() final pass replaces any char outside the safe
kana/punctuation set with a 、 pause.
Verified: custom template full pipeline -> WAV 103316 bytes, no 105.
Rebuild portable zip (80.8 MB)
This commit is contained in:
+14
-2
@@ -189,9 +189,13 @@ function spellWord(word) {
|
||||
}
|
||||
|
||||
// ── English punctuation → Japanese pause equivalents ──────────────────
|
||||
// Characters AquesTalk1 can safely pronounce (kana + limited punctuation).
|
||||
// Anything else (!「」・ etc.) is collapsed to a 、 pause in synthesize().
|
||||
const AQTK_SAFE_RE = /[\u3040-\u309F\u30A0-\u30FF\uFF65-\uFF9F\u3001\u3002\uFF1F\u301C\u30FC\u309B\u309C]/;
|
||||
|
||||
const PUNCT_MAP = {
|
||||
",": "、", ".": "。", "!": "!", "?": "?",
|
||||
",": "、", "。": "。", "!": "!", "?": "?",
|
||||
",": "、", ".": "。", "!": "、", "?": "?",
|
||||
",": "、", "。": "。", "!": "、", "?": "?",
|
||||
" ": "、", // AquesTalk truncates on space; use 、 pause instead
|
||||
};
|
||||
|
||||
@@ -269,6 +273,14 @@ function synthesize(kanaText) {
|
||||
// Collapse consecutive pauses; strip any residual spaces (AquesTalk truncates on space)
|
||||
result = result.replace(/ +/g, "、").replace(/、+/g, "、").replace(/^、|、$/g, "");
|
||||
|
||||
// Replace any remaining chars AquesTalk1 cannot pronounce with a 、 pause
|
||||
// (covers !「」・ etc. that slipped through from user templates)
|
||||
let cleaned = "";
|
||||
for (const ch of result) {
|
||||
cleaned += AQTK_SAFE_RE.test(ch) ? ch : "、";
|
||||
}
|
||||
result = cleaned.replace(/、+/g, "、").replace(/^、|、$/g, "");
|
||||
|
||||
console.error(`[bridge] SYNTH IN: ${trimmed}`);
|
||||
console.error(`[bridge] SYNTH OUT: ${result}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user