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:
+6
-2
@@ -192,6 +192,7 @@ function spellWord(word) {
|
|||||||
const PUNCT_MAP = {
|
const PUNCT_MAP = {
|
||||||
",": "、", ".": "。", "!": "!", "?": "?",
|
",": "、", ".": "。", "!": "!", "?": "?",
|
||||||
",": "、", "。": "。", "!": "!", "?": "?",
|
",": "、", "。": "。", "!": "!", "?": "?",
|
||||||
|
" ": "、", // AquesTalk truncates on space; use 、 pause instead
|
||||||
};
|
};
|
||||||
|
|
||||||
function wordToKana(word) {
|
function wordToKana(word) {
|
||||||
@@ -227,7 +228,7 @@ function convertEnglishSegment(text) {
|
|||||||
|
|
||||||
for (const token of words) {
|
for (const token of words) {
|
||||||
if (/^\s+$/.test(token)) {
|
if (/^\s+$/.test(token)) {
|
||||||
parts.push(" "); // keep word gap for AquesTalk pause
|
parts.push("、"); // word gap: AquesTalk truncates on space, use 、 instead
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (PUNCT_MAP[token] !== undefined) {
|
if (PUNCT_MAP[token] !== undefined) {
|
||||||
@@ -237,7 +238,7 @@ function convertEnglishSegment(text) {
|
|||||||
parts.push(wordToKana(token));
|
parts.push(wordToKana(token));
|
||||||
}
|
}
|
||||||
|
|
||||||
return parts.join("").replace(/ +/g, " ");
|
return parts.join("").replace(/、+/g, "、");
|
||||||
}
|
}
|
||||||
|
|
||||||
function synthesize(kanaText) {
|
function synthesize(kanaText) {
|
||||||
@@ -265,6 +266,9 @@ function synthesize(kanaText) {
|
|||||||
result += convertEnglishSegment(englishBuf);
|
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 IN: ${trimmed}`);
|
||||||
console.error(`[bridge] SYNTH OUT: ${result}`);
|
console.error(`[bridge] SYNTH OUT: ${result}`);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user