From b6a1f62f109bb17d4f9e4fee676e44c0833d04a2 Mon Sep 17 00:00:00 2001 From: Logan King Date: Sat, 5 Jul 2025 12:44:21 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A9=20(cli):=20add=20duck=20flag=20for?= =?UTF-8?q?=20optional=20audio=20ducking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assistant_v2/src/main.rs | 6 +++++- src/main.rs | 2 +- src/options.rs | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/assistant_v2/src/main.rs b/assistant_v2/src/main.rs index 75eed70..addf8a9 100644 --- a/assistant_v2/src/main.rs +++ b/assistant_v2/src/main.rs @@ -42,6 +42,10 @@ struct Opt { #[arg(long, default_value_t = false)] tick: bool, + /// Enable audio ducking while the assistant is speaking. + #[arg(long, default_value_t = false)] + duck: bool, + /// Enable audio ducking while the push-to-talk key is held. #[arg(long, default_value_t = false)] duck_ptt: bool, @@ -290,7 +294,7 @@ async fn main() -> Result<(), Box> { Voice::Echo, opt.speech_speed, opt.tick, - opt.duck_ptt, + opt.duck, ))); let (audio_tx, audio_rx) = flume::unbounded(); diff --git a/src/main.rs b/src/main.rs index fe7c04e..6bcbb45 100644 --- a/src/main.rs +++ b/src/main.rs @@ -976,7 +976,7 @@ async fn main() -> Result<(), Box> { Some(voice) => voice.into(), None => Voice::Echo, }; - let mut speak_stream = ss::SpeakStream::new(ai_voice, opt.speech_speed, opt.tick, true); + let mut speak_stream = ss::SpeakStream::new(ai_voice, opt.speech_speed, opt.tick, opt.duck); if opt.mute { speak_stream.mute(); } diff --git a/src/options.rs b/src/options.rs index 0db34cb..2808538 100644 --- a/src/options.rs +++ b/src/options.rs @@ -32,6 +32,10 @@ pub struct Opt { #[arg(long)] pub tick: bool, + /// Duck other application audio while the assistant is speaking. + #[arg(long)] + pub duck: bool, + /// Duck other application audio while the push-to-talk key is held down. #[arg(long)] pub duck_ptt: bool,