From 439eb175924a622c6fe08381a6c6b5f2ad56f0aa Mon Sep 17 00:00:00 2001 From: tingfei <1228959039@qq.com> Date: Thu, 9 Apr 2026 15:34:35 +0800 Subject: [PATCH] fix(speech): use correct file extension for default output filename When --format is specified without --out, the default output filename always used .mp3 regardless of the requested format. For example, --format wav would produce speech_xxx.mp3 containing WAV audio data, causing tools that rely on file extensions to misidentify the format. Fix: derive the extension from --format flag (defaulting to mp3). Note: music/generate.ts already handles this correctly. --- src/commands/speech/synthesize.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/speech/synthesize.ts b/src/commands/speech/synthesize.ts index 5ad788e..3a80cde 100644 --- a/src/commands/speech/synthesize.ts +++ b/src/commands/speech/synthesize.ts @@ -56,7 +56,8 @@ export default defineCommand({ const model = (flags.model as string) || 'speech-2.8-hd'; const voice = (flags.voice as string) || 'English_expressive_narrator'; const ts = new Date().toISOString().slice(0, 19).replace(/[T:]/g, '-'); - const outPath = (flags.out as string | undefined) ?? `speech_${ts}.mp3`; + const ext = (flags.format as string) || 'mp3'; + const outPath = (flags.out as string | undefined) ?? `speech_${ts}.${ext}`; const outFormat = 'hex'; const format = detectOutputFormat(config.output);