Skip to content

Record computer audio on surround outputs, and say when it can't. - #91

Merged
adavila0703 merged 3 commits into
mainfrom
fix/system-audio-surround
Nov 27, 2026
Merged

adavila0703 merged 3 commits into
mainfrom
fix/system-audio-surround

Conversation

@adavila0703

@adavila0703 adavila0703 commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Capture (the fix). On Windows builds with process loopback (20348+, i.e. Windows 11), the display-media handler now answers with Chromium's loopbackWithoutChrome instead of loopback. The choice lives in src/main/systemAudioSource.ts; older Windows, macOS and Linux keep loopback. Electron types audio as 'loopback' | 'loopbackWithMute' but passes Chromium's other loopback ids through, so there's one @ts-expect-error with the reason.

Why. A Logitech PRO X set to 7.1 surround (8 ch, 44.1 kHz) got mic-only recordings every time. Chromium's log showed device loopback opening WASAPI in stereo float and IAudioClient::Initialize failing with 0x88890008 (AUDCLNT_E_UNSUPPORTED_FORMAT). Process loopback has Windows convert the format, captures every app's audio but Lyra's own, and follows audio to whichever output it plays on.

Failure handling. When computer audio doesn't open, the capture keeps a (silent) computer track and retries 3 times with backoff, and again on output-device changes. Computer audio has its own state (off | live | retrying | unavailable | blocked, nextSystemAudio in audio/recovery.ts) and its own toast, so a mic notice can't hide it: "Trying again…", then "Couldn't capture computer audio, so this is your microphone only." with Retry (macOS keeps Open Settings). Losing it mid-recording is shown, not only logged, and the speaker meter dims while it isn't recorded.

Verified. Standalone Electron test on the affected machine: loopback / loopbackWithMute fail with NotReadableError: Could not start audio source; loopbackWithoutChrome / loopbackAllDevices open with real signal. In pnpm dev: system: "live", systemPeakRms 0.11–0.15 with a call playing (was 0). Not run: qa-test audio pass and speaker evals (transcription/labeling untouched). The new source still gets the renderer's default constraints (AEC/NS/AGC on), as loopback did.

Checks

  • pnpm typecheck (via pnpm check, with new unit tests)
  • Changeset added
  • pnpm smoke:ui
  • Stays local-first (no telemetry; nothing new leaves the device)

@vercel

vercel Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lyra Ready Ready Preview Nov 27, 2026 7:01pm UTC

@adavila0703
adavila0703 force-pushed the fix/system-audio-surround branch from f082662 to bb8fc41 Compare November 27, 2026 17:29
@adavila0703
adavila0703 merged commit 43c1ada into main Nov 27, 2026
13 checks passed
@adavila0703
adavila0703 deleted the fix/system-audio-surround branch November 27, 2026 19:24
@adavila0703 adavila0703 mentioned this pull request Nov 27, 2026
- On Windows 11, capture computer audio with process loopback
  (loopbackWithoutChrome) instead of device loopback: device loopback
  fails with AUDCLNT_E_UNSUPPORTED_FORMAT on a 7.1 output, so calls
  were recorded mic only.
- When computer audio doesn't open, keep its track, retry three times
  and on output changes, and show a lasting message with Retry; losing
  it mid-recording is shown too, not only logged.
- Dim the speaker meter while computer audio isn't being recorded.
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.

1 participant