Support per-channel WAV files for --system-audio with --save-dir#196
Merged
Conversation
--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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends
--save-dirto support--system-audioby writing separate WAV files for each channel (microphone and system audio) instead of rejecting the combination. The microphone stream saves to<stem>-you.wavand system audio to<stem>-system.wav, with a single shared transcript carrying both channels' turns.Key Changes
New
SaveTargetsdataclass (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): Addedchannel_audio()function to insert channel suffixes (-you,-system) into auto-named WAV paths while preserving the date bucket and.wavextension.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 insave_audio_by_label; otherwise, all sources use the singlesave_audiopath.Validation relaxation: Removed the blanket rejection of
--save-dirwith--system-audio. The explicit--save-audioflag is still rejected for two-stream scenarios (can't merge two streams into one file), but--system-audio-onlynow works with--save-audiosince 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 transcripttest_stream_system_audio_only_save_dir_writes_one_labeled_wav: Confirms system-audio-only uses a labeled WAV and never opens the microphonetest_save_audio_allows_system_audio_only: Validates that explicit--save-audioworks with--system-audio-onlyDocumentation updates: Clarified help text and reference docs to explain the per-channel WAV behavior.
Implementation Details
SaveTargetsdataclass (likeStreamOptions) to prevent accidental mid-run retargeting of save destinations.save_audiopath.--system-audioincludes both channels' turns, each prefixed with the source label ("You:", "System:")._FixedDatetimeclass to ensure deterministic auto-generated filenames.https://claude.ai/code/session_01DKJdMMr8hdLEiBnZWS9A3R