Text to Speech
The platform-agnostic tts package turns text into OGG/OPUS bytes for Telegram and Discord upload helpers.
API
ogg, err := tts.Get(ctx, apiKey, "Hello")
Get rejects an empty API key or text and requires ffmpeg to be present in PATH. It requests Gemini model gemini-3.1-flash-tts-preview with the Kore prebuilt voice, decodes the returned PCM audio, then invokes ffmpeg to create mono 24 kHz OGG/OPUS at 32k bitrate. Temporary files are removed after conversion.
Platform integration
telegram.SendVoice uploads the resulting bytes as voice.ogg. discord.SendVoice uploads the same format as an audio/ogg attachment; Discord renders it as an audio attachment rather than a native waveform voice message.