Skip to content

fix(audio): make macOS keep-alive configurable - #962

Open
kevincommits wants to merge 2 commits into
jamiepine:mainfrom
kevincommits:fix/macos-audio-keepalive-toggle
Open

fix(audio): make macOS keep-alive configurable#962
kevincommits wants to merge 2 commits into
jamiepine:mainfrom
kevincommits:fix/macos-audio-keepalive-toggle

Conversation

@kevincommits

@kevincommits kevincommits commented Jul 25, 2026

Copy link
Copy Markdown

Summary

  • Adds a desktop-only Keep audio session active toggle under Settings → Generation.
  • Keeps the existing workaround enabled by default, preserving the fix for MacOS bug: no audio once another app uses the same output #41.
  • Fully unmounts AudioKeepAlive when disabled, so its existing cleanup pauses the loop, clears the media source, and releases the blob URL/CoreAudio output.
  • Avoids mounting the macOS-specific workaround in web builds.
  • Adds the setting text to every shipped locale.

Why

The silent looping element added for #41 prevents WKWebView's audio session from becoming unusable after switching apps, but on some Macs it keeps the physical speaker output active and causes audible idle hiss or interference. Users affected by that tradeoff currently have to quit Voicebox to release the speaker.

This preserves the compatibility workaround for existing users while giving affected users a persistent, immediate way to disable it.

Closes #911.

Verification

  • cd app && bun test tests/audioKeepAlivePolicy.test.ts — 3 passed
  • cd app && bun run typecheck — passed
  • cd app && bun run build — passed
  • bun run ci — app/web type-checks and web production build passed
  • Targeted Biome lint for all changed TypeScript, test, and locale files — passed
  • All nine locale files parse and contain the new setting keys

Summary by CodeRabbit

  • New Features

    • Added a desktop-only setting to keep the audio session active when switching applications.
    • The setting is enabled by default and can be disabled if unwanted speaker noise occurs.
    • Added localized descriptions for the new setting across supported languages.
  • Bug Fixes

    • Improved audio continuity when changing application focus in the desktop app.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d46a69b2-5f35-427d-a01a-c7e5d9e9fa18

📥 Commits

Reviewing files that changed from the base of the PR and between 52f8d8d and 18bb86b.

📒 Files selected for processing (14)
  • app/src/components/AppFrame/AppFrame.tsx
  • app/src/components/AudioPlayer/AudioKeepAlive.tsx
  • app/src/components/ServerTab/GenerationPage.tsx
  • app/src/i18n/locales/en/translation.json
  • app/src/i18n/locales/es/translation.json
  • app/src/i18n/locales/fr/translation.json
  • app/src/i18n/locales/it/translation.json
  • app/src/i18n/locales/ja/translation.json
  • app/src/i18n/locales/ko/translation.json
  • app/src/i18n/locales/pt-BR/translation.json
  • app/src/i18n/locales/zh-CN/translation.json
  • app/src/i18n/locales/zh-TW/translation.json
  • app/src/stores/serverStore.ts
  • app/tests/audioKeepAlivePolicy.test.ts

📝 Walkthrough

Walkthrough

The PR adds a persisted keepAudioSessionAlive setting, exposes it as a Tauri-only generation setting, and conditionally mounts AudioKeepAlive based on the platform and preference. It also adds localized strings and tests for the mounting policy.

Changes

Audio keep-alive preference

Layer / File(s) Summary
Persisted preference and settings control
app/src/stores/serverStore.ts, app/src/components/ServerTab/GenerationPage.tsx, app/src/i18n/locales/*/translation.json
The server store persists keepAudioSessionAlive, while GenerationPage exposes a Tauri-only toggle with localized title and description strings.
Platform-aware keep-alive mounting
app/src/components/AudioPlayer/AudioKeepAlive.tsx, app/src/components/AppFrame/AppFrame.tsx
shouldMountAudioKeepAlive requires both Tauri execution and an enabled preference; AppFrame uses that result to conditionally mount AudioKeepAlive.
Mounting policy validation
app/tests/audioKeepAlivePolicy.test.ts
Tests cover enabled desktop usage, disabled compatibility, and web-app execution.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: making the macOS audio keep-alive configurable.
Linked Issues check ✅ Passed The PR adds a persistent toggle, defaults it on, and unmounts AudioKeepAlive when disabled, matching #911.
Out of Scope Changes check ✅ Passed The tests and locale additions support the new setting and keep-alive policy, so no unrelated changes stand out.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS: AudioKeepAlive keeps the speaker active indefinitely after playback, causing audible hiss and audio interference

1 participant