[PR #7765] [MERGED] fix(tts): preserve descriptive vocal cues and guide Game dialogue #7917

Closed
opened 2026-10-24 04:08:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7765
Author: @SpicyMarinara
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/17/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/tts-emotion-cues


📝 Commits (2)

  • 6e29c87 fix(tts): preserve descriptive vocal cues and guide Game dialogue
  • 9296ea1 test(tts): cover unclosed cues and clarify playback guide

📊 Changes

16 files changed (+583 additions, -20 deletions)

View changed files

📝 docs/media/tts-setup.md (+6 -0)
📝 e2e/scene-tts-preferences.e2e.ts (+26 -1)
📝 packages/client/src/components/game/GameCombatUI.tsx (+1 -0)
📝 packages/client/src/components/game/GameNarration.tsx (+4 -0)
📝 packages/client/src/lib/tts-dialogue.ts (+35 -14)
📝 packages/client/src/lib/tts-roleplay-speaker-extractor.ts (+1 -1)
📝 packages/server/src/routes/encounter.routes.ts (+8 -0)
📝 packages/server/src/routes/game.routes.ts (+5 -0)
📝 packages/server/src/routes/generate.routes.ts (+3 -1)
📝 packages/server/src/routes/tts.routes.ts (+3 -2)
📝 packages/server/src/services/game/gm-prompts.ts (+7 -0)
📝 packages/server/src/services/game/party-prompts.ts (+7 -0)
➕ packages/server/src/services/tts-emotion-guidance.ts (+20 -0)
➕ scripts/regressions/game-tts-emotion-guidance.regression.ts (+102 -0)
➕ scripts/regressions/game-tts-emotion.regression.ts (+306 -0)
📝 scripts/regressions/tts-source-persistence.regression.ts (+49 -1)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7762

Why this change

Emotion-enabled dialogue formatting was losing requested vocal directions to the playback bracket filter. Richer inline cues also let speech models express changes in voice, pace, volume, and emotion without rewriting the dialogue. Game needs the same guidance in its existing scene, party, and combat generation calls.

What changed

  • Enable emotion indicators now overrides Skip text inside square brackets so free-form delivery cues reach speech playback. Turn emotion indicators off to restore the generic bracket filter. Known internal speaker and scene markers are still removed.
  • The Roleplay formatter requests sparse, descriptive cues and demonstrates nuanced delivery while retaining the existing exact-dialogue validator. Game scene, party, and combat prompts request matching cues only with TTS, Game auto-play, and emotion indicators enabled; disabled/default prompts are unchanged.
  • Carry the setting through ordinary speaker/quoted extraction, preserve complete cues across long-text audio chunks, and invalidate audio caches when relevant settings change.
  • Document the setting interaction and add deterministic prompt, playback/request-forwarding, chunk-boundary, and saved-setting browser regressions. Speech provider payload schemas are unchanged.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Recorded automated results on the implementation tree committed as 6e29c87cf, based on eed2c7c2266e66c0326c5cdf07995d9a2e82949e:

  • pnpm install and pnpm check: passed; the full project check was rerun successfully on the final tree.
  • pnpm regression:prompt: passed.
  • node scripts/run-regressions.mjs --filter tts: 10/10 passed, including Game guidance and request forwarding.
  • pnpm smoke:ui: 7/7 passed.
  • pnpm exec playwright test -c playwright.config.ts e2e/scene-tts-preferences.e2e.ts --grep 'TTS playback filters' --project=desktop-chromium --project=mobile-chromium --project=mobile-webkit --workers=1: 3/3 passed.
  • pnpm smoke:production: 3/3 passed across the same browser projects.
  • Local CodeRabbit review: completed across all 15 production/documentation/Node-regression files with two minor observations. The later e2e addition and small command-syntax guidance change received independent review with no findings. Bracket-filter observation is explained below; the valid translation follow-up is tracked in #7763.
  • docker build --platform linux/arm64 --progress plain -f Dockerfile.lite --build-arg BUILD_COMMIT=eed2c7c2266e66c0326c5cdf07995d9a2e82949e --build-arg BUILD_BRANCH=fix/tts-emotion-cues --tag marinara-tts-emotion-local:lite-arm64-eed2c7c2-9b0c3a64 .: passed on native ARM64 Docker/OrbStack. The image contains the final working tree; its baked HEAD metadata names the baseline commit.
  • node scripts/smoke-container.mjs marinara-tts-emotion-local:lite-arm64-eed2c7c2-9b0c3a64 lite arm64: passed write/read phases, covering compiled API/frontend/assets, native bindings, nonroot ownership, persistence, and clean replacement. Temporary container and volume were removed.

Review follow-up 9296ea144 changes only the guide wording and adds an unclosed-bracket regression. pnpm check, the focused source-persistence regression (1/1), and Prettier checks passed again. Both hosted review comments were addressed and their threads resolved. Production code is unchanged by this follow-up.

Manual verification notes

  • The focused automated browser case toggled the actual settings, confirmed descriptive cues survive with the saved setting, compared the disabled control, and verified persistence after reload in desktop Chromium, mobile Chromium, and mobile WebKit.
  • Deterministic baseline/current comparison confirmed the original cue-loss defect. Runtime parser checks preserved the supplied descriptive cue style through Game scene, party, and combat parsing. Additional boundary checks covered 230 long-text cases without broken cues or oversized chunks.
  • Manually verify the audible delivery with an ElevenLabs model that supports audio cues. No paid speech generation, subjective listening test, physical-device playback, or manual theme sweep was performed.

Review disposition: retaining arbitrary bracketed text with emotion indicators enabled is intentional. Free-form and multilingual directions cannot reliably be distinguished from unrelated notes in the current text-only contract. Known structural markers are removed; a semantic allowlist would reject valid requested cues. The guide documents the precedence and the off switch restores filtering. This was a minor review observation, not a finding-free review.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Updated docs/media/tts-setup.md. Translation follow-up: #7763, titled [docs-i18n] docs/media/tts-setup.md. No version or changelog changes.

UI evidence (if applicable)

No new UI or layout. The existing preference controls and their persistence were exercised by the focused browser case.

Summary by CodeRabbit

  • New Features
    • When emotion indicators are enabled, speech can include bracketed vocal cues in Roleplay and Game dialogue, including narration, party, and combat lines.
    • Bracketed cues stay intact when speech is split into chunks, and speaker or scene labels are still removed.
  • Bug Fixes
    • Changes to speech settings now update Game and combat voice configurations, helping generated audio reflect the current options.
    • Roleplay speaker extraction preserves the original dialogue while adding vocal cues.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7765 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/tts-emotion-cues` --- ### 📝 Commits (2) - [`6e29c87`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6e29c87cfc3f463310f33fff2911a001bb67263b) fix(tts): preserve descriptive vocal cues and guide Game dialogue - [`9296ea1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9296ea144d59a94ced209543d0ae8f806b19e915) test(tts): cover unclosed cues and clarify playback guide ### 📊 Changes **16 files changed** (+583 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `docs/media/tts-setup.md` (+6 -0) 📝 `e2e/scene-tts-preferences.e2e.ts` (+26 -1) 📝 `packages/client/src/components/game/GameCombatUI.tsx` (+1 -0) 📝 `packages/client/src/components/game/GameNarration.tsx` (+4 -0) 📝 `packages/client/src/lib/tts-dialogue.ts` (+35 -14) 📝 `packages/client/src/lib/tts-roleplay-speaker-extractor.ts` (+1 -1) 📝 `packages/server/src/routes/encounter.routes.ts` (+8 -0) 📝 `packages/server/src/routes/game.routes.ts` (+5 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+3 -1) 📝 `packages/server/src/routes/tts.routes.ts` (+3 -2) 📝 `packages/server/src/services/game/gm-prompts.ts` (+7 -0) 📝 `packages/server/src/services/game/party-prompts.ts` (+7 -0) ➕ `packages/server/src/services/tts-emotion-guidance.ts` (+20 -0) ➕ `scripts/regressions/game-tts-emotion-guidance.regression.ts` (+102 -0) ➕ `scripts/regressions/game-tts-emotion.regression.ts` (+306 -0) 📝 `scripts/regressions/tts-source-persistence.regression.ts` (+49 -1) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #7762 ## Why this change Emotion-enabled dialogue formatting was losing requested vocal directions to the playback bracket filter. Richer inline cues also let speech models express changes in voice, pace, volume, and emotion without rewriting the dialogue. Game needs the same guidance in its existing scene, party, and combat generation calls. ## What changed - Enable emotion indicators now overrides Skip text inside square brackets so free-form delivery cues reach speech playback. Turn emotion indicators off to restore the generic bracket filter. Known internal speaker and scene markers are still removed. - The Roleplay formatter requests sparse, descriptive cues and demonstrates nuanced delivery while retaining the existing exact-dialogue validator. Game scene, party, and combat prompts request matching cues only with TTS, Game auto-play, and emotion indicators enabled; disabled/default prompts are unchanged. - Carry the setting through ordinary speaker/quoted extraction, preserve complete cues across long-text audio chunks, and invalidate audio caches when relevant settings change. - Document the setting interaction and add deterministic prompt, playback/request-forwarding, chunk-boundary, and saved-setting browser regressions. Speech provider payload schemas are unchanged. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Recorded automated results on the implementation tree committed as `6e29c87cf`, based on `eed2c7c2266e66c0326c5cdf07995d9a2e82949e`: - `pnpm install` and `pnpm check`: passed; the full project check was rerun successfully on the final tree. - `pnpm regression:prompt`: passed. - `node scripts/run-regressions.mjs --filter tts`: 10/10 passed, including Game guidance and request forwarding. - `pnpm smoke:ui`: 7/7 passed. - `pnpm exec playwright test -c playwright.config.ts e2e/scene-tts-preferences.e2e.ts --grep 'TTS playback filters' --project=desktop-chromium --project=mobile-chromium --project=mobile-webkit --workers=1`: 3/3 passed. - `pnpm smoke:production`: 3/3 passed across the same browser projects. - Local CodeRabbit review: completed across all 15 production/documentation/Node-regression files with two minor observations. The later e2e addition and small command-syntax guidance change received independent review with no findings. Bracket-filter observation is explained below; the valid translation follow-up is tracked in #7763. - `docker build --platform linux/arm64 --progress plain -f Dockerfile.lite --build-arg BUILD_COMMIT=eed2c7c2266e66c0326c5cdf07995d9a2e82949e --build-arg BUILD_BRANCH=fix/tts-emotion-cues --tag marinara-tts-emotion-local:lite-arm64-eed2c7c2-9b0c3a64 .`: passed on native ARM64 Docker/OrbStack. The image contains the final working tree; its baked HEAD metadata names the baseline commit. - `node scripts/smoke-container.mjs marinara-tts-emotion-local:lite-arm64-eed2c7c2-9b0c3a64 lite arm64`: passed write/read phases, covering compiled API/frontend/assets, native bindings, nonroot ownership, persistence, and clean replacement. Temporary container and volume were removed. Review follow-up `9296ea144` changes only the guide wording and adds an unclosed-bracket regression. `pnpm check`, the focused source-persistence regression (1/1), and Prettier checks passed again. Both hosted review comments were addressed and their threads resolved. Production code is unchanged by this follow-up. ### Manual verification notes - The focused automated browser case toggled the actual settings, confirmed descriptive cues survive with the saved setting, compared the disabled control, and verified persistence after reload in desktop Chromium, mobile Chromium, and mobile WebKit. - Deterministic baseline/current comparison confirmed the original cue-loss defect. Runtime parser checks preserved the supplied descriptive cue style through Game scene, party, and combat parsing. Additional boundary checks covered 230 long-text cases without broken cues or oversized chunks. - Manually verify the audible delivery with an ElevenLabs model that supports audio cues. No paid speech generation, subjective listening test, physical-device playback, or manual theme sweep was performed. Review disposition: retaining arbitrary bracketed text with emotion indicators enabled is intentional. Free-form and multilingual directions cannot reliably be distinguished from unrelated notes in the current text-only contract. Known structural markers are removed; a semantic allowlist would reject valid requested cues. The guide documents the precedence and the off switch restores filtering. This was a minor review observation, not a finding-free review. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Updated `docs/media/tts-setup.md`. Translation follow-up: #7763, titled `[docs-i18n] docs/media/tts-setup.md`. No version or changelog changes. ## UI evidence (if applicable) No new UI or layout. The existing preference controls and their persistence were exercised by the focused browser case. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - When emotion indicators are enabled, speech can include bracketed vocal cues in Roleplay and Game dialogue, including narration, party, and combat lines. - Bracketed cues stay intact when speech is split into chunks, and speaker or scene labels are still removed. - **Bug Fixes** - Changes to speech settings now update Game and combat voice configurations, helping generated audio reflect the current options. - Roleplay speaker extraction preserves the original dialogue while adding vocal cues. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:08:49 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7917
No description provided.