Skip to content

feat(cli): add MP3 output support alongside WAV#179

Open
F1LIP3 wants to merge 2 commits into
k2-fsa:masterfrom
F1LIP3:master
Open

feat(cli): add MP3 output support alongside WAV#179
F1LIP3 wants to merge 2 commits into
k2-fsa:masterfrom
F1LIP3:master

Conversation

@F1LIP3

@F1LIP3 F1LIP3 commented Jun 6, 2026

Copy link
Copy Markdown

Adds MP3 output (128kbps) alongside WAV across all CLI tools and the web UI.

Changes

  • omnivoice/utils/audio.py — New save_audio() helper: WAV (soundfile) or MP3 128kbps (pydub/ffmpeg) based on file extension.
  • omnivoice/cli/infer.py — Added --format {wav,mp3} argument. Output format inferred from extension; --format overrides it.
  • omnivoice/cli/infer_batch.py — Added --format {wav,mp3} argument (default: wav). Batch output respects format.
  • omnivoice/cli/demo.py — "Output format / 输出格式" dropdown (WAV/MP3) on both Voice Clone and Voice Design tabs.
  • QUICKSTART.md — Updated CLI examples with MP3 usage.

File Size (same 4.3s clip)

Format Size
WAV 157.5 KB
MP3 128kbps 50.3 KB

MP3 is 3.1x smaller for identical audio quality.

Usage

# Extension determines format
omnivoice-infer --text "Hello" --output hello.mp3

# Batch with MP3
omnivoice-infer-batch --test_list tasks.jsonl --res_dir results/ --format mp3

- omnivoice/utils/audio.py: save_audio() helper — WAV or MP3 128kbps by extension
- omnivoice/cli/infer.py: --format {wav,mp3} argument
- omnivoice/cli/infer_batch.py: --format {wav,mp3} argument (default: wav)
- omnivoice/cli/demo.py: Output format dropdown (WAV/MP3) on both tabs
- demo.py: save temp MP3 to system tempdir (was in .venv/ — unserverable by Gradio ASGI)
- demo.py: move theme/css from Blocks() to launch() per Gradio 6.0 API
- Clean up orphaned temp MP3 files from module directory
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.

1 participant