Introduction

When the bot speaks a reply, that audio has to arrive as something the chat app can play smoothly. Telegram and Discord both have a native format for it, and the default TTS provider does not produce that format directly. Understanding the gap, and the one tool that bridges it, saves a genuinely confusing afternoon.

Key Concepts

  • Voice bubble: The native, inline, playable audio message in Telegram and Discord, the kind that looks like a voice note a person would send.
  • Opus and OGG: The audio codec and container that voice bubbles require.
  • ffmpeg: A system tool that converts audio between formats, here from MP3 to Opus.
  • Native-Opus provider: A TTS provider that outputs Opus directly, with no conversion step needed.

Real World Context

A developer sets up a Telegram bot with the default Edge TTS voice. The replies play fine, but they show up as a flat rectangular audio player, not the round inline voice bubble they expected. Nothing is actually broken. The audio is simply in the wrong format, and a single missing tool explains the whole thing.

Deep Dive

Telegram and Discord both deliver a spoken reply as a voice bubble: the inline, playable audio message that looks like a voice note from a person. That format is Opus audio inside an OGG container.

The catch is the default TTS provider. Edge TTS, the free default text-to-speech engine, outputs MP3, not Opus. Something has to convert MP3 to Opus before a voice bubble can render, and that something is ffmpeg, a system dependency. You may already have ffmpeg installed, because the CLI voice pipeline uses it too. With ffmpeg available, Edge TTS audio is converted and arrives as a proper voice bubble. Without it, the reply is still delivered and still plays, but as a plain rectangular file player rather than a bubble. It is functional, just less polished.

There is a shortcut worth knowing. Some TTS providers output Opus natively: OpenAI, ElevenLabs, and Mistral. With one of those selected, no conversion is needed and ffmpeg is not involved at all. So there are two clean routes to voice bubbles: keep free Edge TTS and install ffmpeg, or switch to a native-Opus provider. Both are documented, and the right one depends on whether you would rather install a tool or change a provider.

Discord adds one wrinkle. It normally delivers the native voice bubble, but if that delivery path fails, it falls back to sending the audio as a regular file attachment. A reply is never lost, only occasionally downgraded in presentation.

Voice also flows inbound. When a user sends the bot a voice note, that audio is transcribed automatically by the configured STT provider, the same speech-to-text engine from earlier in this course, and reaches the agent as ordinary text. Delivery is a two-way concern: STT handles audio on the way in, and TTS plus container conversion handles it on the way out.

Common Pitfalls

  1. Expecting voice bubbles from Edge TTS without ffmpeg: Edge TTS outputs MP3. Without ffmpeg to convert it to Opus, replies arrive as a rectangular file player instead of a bubble. The audio still plays, so it is easy to misread as a different problem.
  2. Forgetting the inbound direction: Spoken replies are only half of delivery. Voice notes the user sends are transcribed by STT, so the provider choices you already learned still apply to a messaging bot.

Best Practices

  1. Pick a voice-bubble route deliberately: Either install ffmpeg and keep free Edge TTS, or switch to a native-Opus provider such as OpenAI, ElevenLabs, or Mistral. Both routes produce proper bubbles.
  2. Read a rectangular player as a format clue: If replies play but are not bubbles, suspect the audio format and a missing ffmpeg, not the bot, the network, or the provider's quality.

Summary

  • Telegram and Discord render spoken replies as voice bubbles, which require Opus audio in an OGG container.
  • Edge TTS outputs MP3, so it needs ffmpeg to convert to Opus; without ffmpeg the reply still plays, but as a file player.
  • OpenAI, ElevenLabs, and Mistral output Opus natively and skip the conversion step entirely.
  • Inbound voice notes are transcribed by the configured STT provider, so delivery is a two-way concern.

Code Examples

bash
# Route 1: keep the free Edge TTS default, install ffmpeg to convert MP3 to Opus
brew install ffmpeg              # macOS
# sudo apt install ffmpeg        # Debian or Ubuntu

# Route 2: pick a provider that outputs Opus natively, so no ffmpeg is needed
# ~/.hermes/config.yaml
#   tts:
#     provider: "openai"         # or "elevenlabs" or "mistral"
✓ Completed