Skip to content

fix(speech): use correct file extension for default output filename#63

Merged
RyanLee-Dev merged 1 commit intoMiniMax-AI:mainfrom
fifteen42:fix/speech-default-filename-extension
Apr 9, 2026
Merged

fix(speech): use correct file extension for default output filename#63
RyanLee-Dev merged 1 commit intoMiniMax-AI:mainfrom
fifteen42:fix/speech-default-filename-extension

Conversation

@fifteen42
Copy link
Copy Markdown
Contributor

Problem

When --format is specified without --out, the default output filename always used .mp3 regardless of the requested format:

mmx speech synthesize --text "Hello" --format wav
# Produces: speech_2026-04-09-07-15-14.mp3
# Actual content: RIFF WAVE audio

This means the file extension does not match the actual audio format. Tools that rely on file extensions (ffmpeg, audio editors, upload APIs, scripts) will misidentify or fail to process the file.

Fix

Derive the extension from the --format flag, defaulting to mp3 when not specified:

// Before
const outPath = (flags.out as string | undefined) ?? `speech_${ts}.mp3`;

// After
const ext = (flags.format as string) || 'mp3';
const outPath = (flags.out as string | undefined) ?? `speech_${ts}.${ext}`;

This only affects the auto-generated filename. Users who explicitly pass --out <path> are unaffected.

Note: music/generate.ts already handles this correctly — this brings speech/synthesize.ts in line with the same pattern.

Reproduction

mmx speech synthesize --text "hi" --format wav
file speech_*.mp3   # RIFF WAVE audio — extension mismatch

After fix:

mmx speech synthesize --text "hi" --format wav
# Produces: speech_xxx.wav  ✓

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.
@RyanLee-Dev RyanLee-Dev merged commit e00be9b into MiniMax-AI:main Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants