Skip to content

Support per-channel WAV files for --system-audio with --save-dir#196

Merged
alexkroman merged 1 commit into
mainfrom
claude/stoic-babbage-n9s4vx
Jun 16, 2026
Merged

Support per-channel WAV files for --system-audio with --save-dir#196
alexkroman merged 1 commit into
mainfrom
claude/stoic-babbage-n9s4vx

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

Summary

Extends --save-dir to support --system-audio by writing separate WAV files for each channel (microphone and system audio) instead of rejecting the combination. The microphone stream saves to <stem>-you.wav and system audio to <stem>-system.wav, with a single shared transcript carrying both channels' turns.

Key Changes

  • New SaveTargets dataclass (aai_cli/commands/stream/_exec.py): Replaces the tuple return from _resolve_save_targets() with a frozen carrier that distinguishes between single-source audio (audio) and parallel-stream audio (audio_by_label). This allows the session to route each channel to its own file.

  • Per-channel filename support (aai_cli/streaming/naming.py): Added channel_audio() function to insert channel suffixes (-you, -system) into auto-named WAV paths while preserving the date bucket and .wav extension.

  • Session routing logic (aai_cli/streaming/session.py): New _audio_target() method determines which WAV file a source tees to based on its label and the save configuration. Under --system-audio, each channel looks up its path in save_audio_by_label; otherwise, all sources use the single save_audio path.

  • Validation relaxation: Removed the blanket rejection of --save-dir with --system-audio. The explicit --save-audio flag is still rejected for two-stream scenarios (can't merge two streams into one file), but --system-audio-only now works with --save-audio since it's a single stream.

  • Test coverage: Added two integration tests demonstrating the feature:

    • test_stream_system_audio_save_dir_writes_one_wav_per_channel: Verifies mic and system streams write to separate WAVs with a shared transcript
    • test_stream_system_audio_only_save_dir_writes_one_labeled_wav: Confirms system-audio-only uses a labeled WAV and never opens the microphone
    • test_save_audio_allows_system_audio_only: Validates that explicit --save-audio works with --system-audio-only
  • Documentation updates: Clarified help text and reference docs to explain the per-channel WAV behavior.

Implementation Details

  • Uses a frozen SaveTargets dataclass (like StreamOptions) to prevent accidental mid-run retargeting of save destinations.
  • Maintains backward compatibility: single-source streams (mic, file, URL, stdin) continue to use the existing save_audio path.
  • The shared transcript under --system-audio includes both channels' turns, each prefixed with the source label ("You:", "System:").
  • Datetime mocking in tests uses a custom _FixedDatetime class to ensure deterministic auto-generated filenames.

https://claude.ai/code/session_01DKJdMMr8hdLEiBnZWS9A3R

--save-dir --system-audio previously errored ("the mic and system streams
can't share one recording") because the parallel mic + system streams can't
tee to a single WAV. Instead of refusing, --save-dir now writes one file per
channel — <stem>-you.wav and <stem>-system.wav — beside the single shared
transcript, so a meeting recorder gets both sides captured. --system-audio-only
saves its lone stream to <stem>-system.wav, and explicit --save-audio is now
also allowed with --system-audio-only (a single stream, one file) while still
rejected for the two-stream --system-audio.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DKJdMMr8hdLEiBnZWS9A3R
@alexkroman alexkroman enabled auto-merge June 16, 2026 22:29
@alexkroman alexkroman added this pull request to the merge queue Jun 16, 2026
Merged via the queue into main with commit 3e18379 Jun 16, 2026
19 checks passed
@alexkroman alexkroman deleted the claude/stoic-babbage-n9s4vx branch June 16, 2026 22:37
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.

2 participants