Skip to content

Commit 79c458f

Browse files
committed
fix: -o/--output now disables speaker playback by default
Previously, using -o to save audio to a file would ALSO play through speakers (since --play defaults to true). This was unexpected - if you're saving to file, you probably don't want it blasting through speakers. Now -o implies --play=false unless --play is explicitly provided. To get the old behavior (save AND play), use: sag -o file.mp3 --play
1 parent f30b21c commit 79c458f

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Unreleased
4+
### Fixed
5+
- `-o/--output` now disables speaker playback by default unless `--play` is explicitly set. Previously `-o` saved to file AND played through speakers, which was confusing.
6+
37
## 0.2.0 - 2025-12-19
48
### Added
59
- Voice control flags: `--stability`, `--similarity`/`--similarity-boost`, `--style`, `--speaker-boost`/`--no-speaker-boost`.

cmd/speak.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ func init() {
101101
if inferred := inferFormatFromExt(opts.outputPath); inferred != "" {
102102
opts.outputFmt = inferred
103103
}
104+
// Disable playback when -o is set, unless --play was explicitly provided
105+
if !cmd.Flags().Changed("play") {
106+
opts.play = false
107+
}
104108
}
105109

106110
ctx, cancel := context.WithTimeout(cmd.Context(), 90*time.Second)
@@ -137,7 +141,7 @@ func init() {
137141
cmd.Flags().StringVar(&opts.voiceID, "voice-id", "", "Voice ID to use (ELEVENLABS_VOICE_ID)")
138142
cmd.Flags().StringVarP(&opts.voiceID, "voice", "v", opts.voiceID, "Alias for --voice-id; accepts name or ID; use '?' to list voices")
139143
cmd.Flags().StringVar(&opts.modelID, "model-id", opts.modelID, "Model ID (default: eleven_v3). Common: eleven_multilingual_v2 (stable), eleven_flash_v2_5 (fast/cheap), eleven_turbo_v2_5 (balanced).")
140-
cmd.Flags().StringVarP(&opts.outputPath, "output", "o", "", "Write audio to this file (in addition to playback)")
144+
cmd.Flags().StringVarP(&opts.outputPath, "output", "o", "", "Write audio to file (disables playback unless --play is also set)")
141145
cmd.Flags().StringVar(&opts.outputFmt, "format", opts.outputFmt, "Output format (e.g. mp3_44100_128)")
142146
cmd.Flags().BoolVar(&opts.stream, "stream", opts.stream, "Stream audio while generating")
143147
cmd.Flags().BoolVar(&opts.play, "play", opts.play, "Play audio through speakers")

0 commit comments

Comments
 (0)