feat(voice): add requireHeadphones config to gate voice on audio output device#898
Closed
blu3dot wants to merge 1 commit intodanielmiessler:mainfrom
Closed
feat(voice): add requireHeadphones config to gate voice on audio output device#898blu3dot wants to merge 1 commit intodanielmiessler:mainfrom
blu3dot wants to merge 1 commit intodanielmiessler:mainfrom
Conversation
…ut device New `voice.requireHeadphones` setting in settings.json (default: false). When enabled, VoiceServer checks the default audio output device via `system_profiler SPAudioDataType -json` and skips voice playback if the output is built-in laptop speakers. Voice plays normally through Bluetooth, USB, HDMI, AirPlay, and other external audio devices. - Uses `-json` flag for reliable machine-parseable output - Caches detection result for 30 seconds (system_profiler takes 140-250ms) - 3-second timeout prevents hangs if system_profiler stalls - Fails open — if detection fails, voice plays anyway (convenience, not security) - Desktop notification banners display regardless of headphone state - Config uses `=== true` (opt-in, missing key defaults to OFF) - TODO: Linux equivalent (see danielmiessler#855, danielmiessler#872) References danielmiessler#855 Co-Authored-By: Claude <noreply@anthropic.com>
Author
|
Closing to test locally before resubmitting. |
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
New
voice.requireHeadphonessetting that gates voice playback on the audio output device type. When enabled, voice is skipped through built-in laptop speakers but plays normally through headphones, AirPods, USB DACs, HDMI audio, and other external devices.Problem
Users in shared environments (offices, cafes, meetings) have no way to prevent voice from blasting through laptop speakers. The only option is disabling voice entirely, losing the feature when headphones are connected.
Solution
Config (
settings.json):{ "voice": { "requireHeadphones": false } }Default
false— opt-in, non-breaking. Uses=== trueso missing key defaults to OFF.Detection — queries
system_profiler SPAudioDataType -jsonand checks the CoreAudio Transport type of the default output device:coreaudio_device_type_builtincoreaudio_device_type_bluetoothcoreaudio_device_type_usbcoreaudio_device_type_hdmicoreaudio_device_type_airplayKey design decisions:
system_profilertakes 140-250ms; cache prevents repeated slow calls during burst scenarios (e.g., 10 notifications during a build)system_profilerstalls-jsonflag for reliable machine-parseable output (no text scraping)macOS-only —
system_profileris macOS-specific. Linux equivalent is out of scope (see #855, #872 for cross-platform audio work).References #855
Test plan
requireHeadphones: true→ voice plays🔇requireHeadphones: false(default) → voice plays regardless of output device/healthendpoint showsrequire_headphonesfieldPost-Deploy Monitoring & Validation
No additional operational monitoring required: opt-in feature defaulting to OFF, zero behavior change for existing users.