[PR #5152] [MERGED] feat(audio): first-class audio connections (#5146) #6652

Closed
opened 2026-10-23 04:12:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5152
Author: @kolacheee
Created: 8/16/2026
Status: ✅ Merged
Merged: 8/16/2026
Merged by: @kolacheee

Base: staging ← Head: feat/5146-audio-connections


📝 Commits (8)

  • e8abae6 feat(connections): audio provider type — shared, schema, and storage layers (#5146)
  • c77af48 feat(audio): TTS resolution through audio connections + boot migration (#5146)
  • 6956a76 feat(audio): client audio connections — editor, panel, game setup, transfer fidelity
  • 693c507 fix(game): keep media connections out of the wizard GM and scene pickers
  • d3d93d8 fix(audio): pre-ready review round — 13 confirmed findings + 5 low-severity hardenings
  • f90ffb8 fix(audio): CodeRabbit round — shared flag helper, filter reuse, partial-capability hint, localized labels, docs follow-up
  • 295105c fix(audio): quarantine filters use the shared flag helper
  • 8096b76 refactor(audio): shared filterAudioGenerationConnections helper

📊 Changes

28 files changed (+903 additions, -67 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 packages/client/src/components/agents/AgentEditor.tsx (+6 -2)
📝 packages/client/src/components/chat/StoryboardChatSettingsPanel.tsx (+4 -1)
📝 packages/client/src/components/chat/SummaryPopover.tsx (+2 -1)
📝 packages/client/src/components/connections/ConnectionEditor.tsx (+206 -14)
📝 packages/client/src/components/game/GameSetupWizard.tsx (+167 -5)
📝 packages/client/src/components/game/GameSurface.tsx (+44 -6)
📝 packages/client/src/components/panels/ConnectionsPanel.tsx (+37 -16)
📝 packages/client/src/components/panels/settings/TTSConfigCard.tsx (+5 -1)
📝 packages/client/src/hooks/use-connections.ts (+4 -0)
📝 packages/client/src/lib/connection-filters.ts (+24 -1)
📝 packages/client/src/lib/connection-transfer.ts (+23 -0)
📝 packages/client/src/lib/game-setup-share.ts (+17 -1)
📝 packages/client/src/lib/tts-service.ts (+4 -0)
📝 packages/client/src/localization/locales/en.json (+27 -1)
📝 packages/server/src/app.ts (+6 -0)
📝 packages/server/src/db/schema/connections.ts (+9 -0)
📝 packages/server/src/routes/backup.routes.ts (+1 -0)
📝 packages/server/src/routes/game.routes.ts (+11 -1)
📝 packages/server/src/routes/tts.routes.ts (+79 -9)

...and 8 more files

📄 Description

Linked issue

Closes #5146

Why this change

Music and sound-effect generation for Game Mode is currently gated on the single global TTS settings blob — one shared source, key, and pair of feature toggles for the whole install, buried under Settings → TTS. That blocked the audio roadmap discussed in #5146 (and the follow-up music redesign in #5145): there is no way to say "this game uses this ElevenLabs account with music on," no category default/fallback like image and video connections already have, and package/game features can't discover whether a capable audio backend even exists. This PR makes audio a first-class connection type so speech, sound effects, and music resolve through the same connection model as every other generation category.

What changed

  • Shared/schema/DB layers: new audio provider with audioSource (elevenlabs / openai / pockettts / xai), audioVoice, and per-connection audioSoundEffects / audioMusic capability flags; audio participates in the category-scoped default/fallback exclusivity that image and video use; MODEL_LISTS.audio seeds the known per-source TTS models.
  • TTS resolution seam: /tts/speak, /tts/game-audio, /tts/voices, and /tts/models resolve their config through an audio connection (explicit audioConnectionId → category default → fallback) and fall back to the legacy TTS settings blob when no audio connection exists — the blob keeps owning playback knobs (speed, stability, extractor settings) either way.
  • Boot migration: a configured legacy TTS blob is converted once into an equivalent default audio connection (marker-gated, idempotent, never deletes the blob), so upgrades reproduce pre-upgrade behavior exactly.
  • Connection editor: audio section with source tiles (seeding base URL/model/voice per source), default-voice field, and ElevenLabs-only game sound-effect/music toggles; chat-only fields hidden as for other media providers; audio excluded from embeddings/captioning/local-endpoint options and every language-connection picker (agents, storyboard, summary, TTS extractor, defaults panel).
  • Connections panel: audio icon and an Audio group in the Defaults section.
  • Game Setup wizard: per-game audio-connection picker plus sound-effect/music toggles that gray out when no capable (ElevenLabs) connection is available; choices persist to chat metadata (gameAudioConnectionId, enable flags) and round-trip through setup-share files with an audio connection snapshot.
  • GameSurface: sfx/music capability now derives from the resolved audio connection (mirroring the server's resolution order) plus the per-game enable flags, and passes the resolved connection id to /tts/game-audio.
  • Fix (pre-existing): the wizard's GM and scene-helper dropdowns offered every connection row — image/video (and now audio) connections could be selected to run the GM; both pickers now use a language-only list.
  • Connection export/import envelopes carry the audio fields (keys still never exported).

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

Manual verification notes

Already exercised on a local playtest install (agent-run, so treat as a to-do list to reconfirm):

  • Seeded a configured legacy ElevenLabs TTS blob (encrypted key, voice, both game-audio flags on) → boot created an "ElevenLabs" audio connection with source/model/voice/flags carried over and defaultForAgents set; marker written; blob preserved; restart created no duplicate.
  • Connections panel shows the Audio defaults group with the migrated connection selected; Main/Agents pickers exclude it; /api/connections masks the key.
  • Connection editor for the migrated row shows the audio section (ElevenLabs tile active, voice prefilled, both toggles on) and hides chat-only sections.
  • Wizard GM dropdown no longer offers the audio connection.

Still needs a human pass in a real browser:

  • Manually verify the Game Setup wizard Features step: the Game Audio card (connection picker, sound-effect/music toggles graying out when the selected connection lacks the capability, empty-state note with no audio connections) — my headless environment could not advance the animated wizard steps.
  • Manually verify /tts/speak and game sound-effect/music generation end-to-end against a real ElevenLabs key, with and without an explicit per-game audio connection.
  • Manually verify creating a fresh audio connection via New Connection → Audio and switching sources (base URL/model/voice seeding).

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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)

CHANGELOG entry added under Unreleased. docs/CONFIGURATION.md (TTS section) will need a follow-up pass once the surface settles — flagged rather than done here so the docs land alongside the music-generation redesign that builds on this (#5145 discussion).

Summary by CodeRabbit

  • New Features

    • Added audio connections supporting multiple speech providers, voices, models, sound effects, and music.
    • Added configurable audio defaults, fallbacks, capability controls, and discovery.
    • Speech, game music, and scene sound effects now use selected audio connections.
    • Game Setup supports audio connection selection and independent music and sound-effect settings.
    • Audio settings are preserved when exporting, importing, or sharing connection and game setup data.
    • Audio connections are excluded from language-model and unrelated media selections.
  • Migration

    • Existing text-to-speech settings are automatically converted into an audio connection.

🔄 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/5152 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 8/16/2026 **Status:** ✅ Merged **Merged:** 8/16/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/5146-audio-connections` --- ### 📝 Commits (8) - [`e8abae6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e8abae6208e6c6ca75d69b0a8b0703bdb567d7b5) feat(connections): audio provider type — shared, schema, and storage layers (#5146) - [`c77af48`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c77af48d8444429e8efb7da8cfa4d5a3eefd1866) feat(audio): TTS resolution through audio connections + boot migration (#5146) - [`6956a76`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6956a76923442974e809343b632499995fab79e3) feat(audio): client audio connections — editor, panel, game setup, transfer fidelity - [`693c507`](https://github.com/Pasta-Devs/Marinara-Engine/commit/693c507cbd394817f0ffda93d81e4d27f0639037) fix(game): keep media connections out of the wizard GM and scene pickers - [`d3d93d8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d3d93d8a854cf19db808b4b671c88d8d439757ec) fix(audio): pre-ready review round — 13 confirmed findings + 5 low-severity hardenings - [`f90ffb8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f90ffb8382816e2fddbecc08e6561afca7b05160) fix(audio): CodeRabbit round — shared flag helper, filter reuse, partial-capability hint, localized labels, docs follow-up - [`295105c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/295105c3e047161af613bfe7fc467000c5f44c5a) fix(audio): quarantine filters use the shared flag helper - [`8096b76`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8096b76f153de0b594b94da5be5b2be096c0fde7) refactor(audio): shared filterAudioGenerationConnections helper ### 📊 Changes **28 files changed** (+903 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `packages/client/src/components/agents/AgentEditor.tsx` (+6 -2) 📝 `packages/client/src/components/chat/StoryboardChatSettingsPanel.tsx` (+4 -1) 📝 `packages/client/src/components/chat/SummaryPopover.tsx` (+2 -1) 📝 `packages/client/src/components/connections/ConnectionEditor.tsx` (+206 -14) 📝 `packages/client/src/components/game/GameSetupWizard.tsx` (+167 -5) 📝 `packages/client/src/components/game/GameSurface.tsx` (+44 -6) 📝 `packages/client/src/components/panels/ConnectionsPanel.tsx` (+37 -16) 📝 `packages/client/src/components/panels/settings/TTSConfigCard.tsx` (+5 -1) 📝 `packages/client/src/hooks/use-connections.ts` (+4 -0) 📝 `packages/client/src/lib/connection-filters.ts` (+24 -1) 📝 `packages/client/src/lib/connection-transfer.ts` (+23 -0) 📝 `packages/client/src/lib/game-setup-share.ts` (+17 -1) 📝 `packages/client/src/lib/tts-service.ts` (+4 -0) 📝 `packages/client/src/localization/locales/en.json` (+27 -1) 📝 `packages/server/src/app.ts` (+6 -0) 📝 `packages/server/src/db/schema/connections.ts` (+9 -0) 📝 `packages/server/src/routes/backup.routes.ts` (+1 -0) 📝 `packages/server/src/routes/game.routes.ts` (+11 -1) 📝 `packages/server/src/routes/tts.routes.ts` (+79 -9) _...and 8 more files_ </details> ### 📄 Description ## Linked issue Closes #5146 ## Why this change Music and sound-effect generation for Game Mode is currently gated on the single global TTS settings blob — one shared source, key, and pair of feature toggles for the whole install, buried under Settings → TTS. That blocked the audio roadmap discussed in #5146 (and the follow-up music redesign in #5145): there is no way to say "this game uses this ElevenLabs account with music on," no category default/fallback like image and video connections already have, and package/game features can't discover whether a capable audio backend even exists. This PR makes audio a first-class connection type so speech, sound effects, and music resolve through the same connection model as every other generation category. ## What changed - **Shared/schema/DB layers:** new `audio` provider with `audioSource` (elevenlabs / openai / pockettts / xai), `audioVoice`, and per-connection `audioSoundEffects` / `audioMusic` capability flags; audio participates in the category-scoped default/fallback exclusivity that image and video use; `MODEL_LISTS.audio` seeds the known per-source TTS models. - **TTS resolution seam:** `/tts/speak`, `/tts/game-audio`, `/tts/voices`, and `/tts/models` resolve their config through an audio connection (explicit `audioConnectionId` → category default → fallback) and fall back to the legacy TTS settings blob when no audio connection exists — the blob keeps owning playback knobs (speed, stability, extractor settings) either way. - **Boot migration:** a configured legacy TTS blob is converted once into an equivalent default audio connection (marker-gated, idempotent, never deletes the blob), so upgrades reproduce pre-upgrade behavior exactly. - **Connection editor:** audio section with source tiles (seeding base URL/model/voice per source), default-voice field, and ElevenLabs-only game sound-effect/music toggles; chat-only fields hidden as for other media providers; audio excluded from embeddings/captioning/local-endpoint options and every language-connection picker (agents, storyboard, summary, TTS extractor, defaults panel). - **Connections panel:** audio icon and an Audio group in the Defaults section. - **Game Setup wizard:** per-game audio-connection picker plus sound-effect/music toggles that gray out when no capable (ElevenLabs) connection is available; choices persist to chat metadata (`gameAudioConnectionId`, enable flags) and round-trip through setup-share files with an audio connection snapshot. - **GameSurface:** sfx/music capability now derives from the resolved audio connection (mirroring the server's resolution order) plus the per-game enable flags, and passes the resolved connection id to `/tts/game-audio`. - **Fix (pre-existing):** the wizard's GM and scene-helper dropdowns offered every connection row — image/video (and now audio) connections could be selected to run the GM; both pickers now use a language-only list. - Connection export/import envelopes carry the audio fields (keys still never exported). ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes Already exercised on a local playtest install (agent-run, so treat as a to-do list to reconfirm): - Seeded a configured legacy ElevenLabs TTS blob (encrypted key, voice, both game-audio flags on) → boot created an "ElevenLabs" audio connection with source/model/voice/flags carried over and `defaultForAgents` set; marker written; blob preserved; restart created no duplicate. - Connections panel shows the Audio defaults group with the migrated connection selected; Main/Agents pickers exclude it; `/api/connections` masks the key. - Connection editor for the migrated row shows the audio section (ElevenLabs tile active, voice prefilled, both toggles on) and hides chat-only sections. - Wizard GM dropdown no longer offers the audio connection. Still needs a human pass in a real browser: - Manually verify the Game Setup wizard Features step: the Game Audio card (connection picker, sound-effect/music toggles graying out when the selected connection lacks the capability, empty-state note with no audio connections) — my headless environment could not advance the animated wizard steps. - Manually verify `/tts/speak` and game sound-effect/music generation end-to-end against a real ElevenLabs key, with and without an explicit per-game audio connection. - Manually verify creating a fresh audio connection via New Connection → Audio and switching sources (base URL/model/voice seeding). ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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) CHANGELOG entry added under Unreleased. `docs/CONFIGURATION.md` (TTS section) will need a follow-up pass once the surface settles — flagged rather than done here so the docs land alongside the music-generation redesign that builds on this (#5145 discussion). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added audio connections supporting multiple speech providers, voices, models, sound effects, and music. - Added configurable audio defaults, fallbacks, capability controls, and discovery. - Speech, game music, and scene sound effects now use selected audio connections. - Game Setup supports audio connection selection and independent music and sound-effect settings. - Audio settings are preserved when exporting, importing, or sharing connection and game setup data. - Audio connections are excluded from language-model and unrelated media selections. - **Migration** - Existing text-to-speech settings are automatically converted into an audio connection. <!-- 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-23 04:12:26 +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#6652
No description provided.