Skip to content

fix(tts): gate Edge TTS OGG conversion on Telegram delivery (#26404) - #26748

Closed
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/26404-edge-tts-mp3-no-ogg-cli
Closed

fix(tts): gate Edge TTS OGG conversion on Telegram delivery (#26404)#26748
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/26404-edge-tts-mp3-no-ogg-cli

Conversation

@Tranquil-Flow

Copy link
Copy Markdown
Contributor

What does this PR do?

Gates the Edge TTS post-generation OGG/Opus conversion on want_opus (already computed from HERMES_SESSION_PLATFORM == 'telegram') so non-Telegram callers keep the native MP3 output. Before this fix, every Edge TTS call ran the OGG re-encode unconditionally, which broke CLI playback on macOS (afplay can't reliably play OGG/Opus) and returned a file_path that no longer matched the caller-supplied .mp3 path.

Related Issue

Fixes #26404

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature
  • 🔒 Security fix
  • 📝 Documentation update
  • ♻️ Refactor
  • 🧪 Tests only

How was this tested?

Added tests/tools/test_tts_edge_no_ogg_cli.py covering:

  • CLI session (no HERMES_SESSION_PLATFORM) → native .mp3 preserved
  • Telegram session → OGG/Opus conversion still runs
  • Non-Telegram platforms (Discord, Slack) → MP3 preserved

Ran the new test file plus the existing tts_tool suite — all pass.

Scope notes

  • Only Edge TTS is affected (it writes MP3 natively and was the only provider that unconditionally re-encoded to OGG). NeuTTS/KittenTTS WAV output is unchanged.
  • The want_opus flag is the existing platform-aware gate already used for Telegram voice bubble delivery — this PR just routes the conversion block through it.

Checklist

  • I have read the contributing guidelines
  • My code follows the existing code style
  • I have added tests that prove my fix is effective
  • All new and existing tests pass locally
  • I have updated documentation where needed (none required — internal behavior)

Edge TTS writes MP3 natively, but the post-generation OGG/Opus
conversion fired for every platform — including CLI on macOS, where
afplay can't reliably play OGG/Opus and the returned file_path no
longer matched the caller-supplied .mp3 path.

Gate the conversion block on want_opus (already computed from
HERMES_SESSION_PLATFORM == 'telegram') so the OGG/Opus re-encode only
runs when it's actually needed for Telegram voice bubbles. Non-Telegram
callers keep the native MP3 (or WAV for NeuTTS/KittenTTS) output.

Fixes NousResearch#26404
@alt-glitch alt-glitch added type/bug Something isn't working tool/tts Text-to-speech and transcription P2 Medium — degraded but workaround exists labels May 16, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #26406 which fixes the same issue (#26404 — unconditional MP3→OGG conversion breaks CLI playback). Both PRs gate the OGG conversion on Telegram platform detection.

@Tranquil-Flow

Copy link
Copy Markdown
Contributor Author

Closing as graceful supersession by #26406 (@aqilaziz, opened 2026-05-15, ~1 day earlier). Both PRs gate the OGG conversion on Telegram platform detection so non-Telegram sessions retain native MP3/WAV.

@aqilaziz's PR is more comprehensive (+108/-12 vs ours +92/-1) — additionally preserves native Edge MP3 for CLI/local paths with explicit .mp3 output and includes CI stabilizer adjustments. Going with theirs. Thanks for the quick fix @aqilaziz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists tool/tts Text-to-speech and transcription type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Unnecessary MP3→OGG conversion in Edge TTS breaks local CLI playback on macOS

2 participants