Oopenvela-robotInitial commit
87624305创建于 4月11日历史提交

TTS Speak

Play spoken text aloud using Google Translate TTS via music_play.

This is a creative workaround: Google Translate's TTS endpoint returns MP3 audio that can be played directly through the music player, enabling text-to-speech without requiring the Volcengine TTS backend to be configured.

When to use

When user says say this, speak, read aloud, announce, or wants the device to speak specific text. Also useful for cron-based voice reminders.

How to use

  1. URL-encode the text (replace spaces with %20, Chinese characters with %XX encoding)
  2. Build the Google TTS URL:
  3. music_play with the URL: {"url":"<tts_url>","autostart":true}
  4. For long text (>200 chars): split into sentences and play sequentially

Supported languages

Use the tl parameter:

  • zh-CN (Chinese), en (English), ja (Japanese), ko (Korean)
  • fr (French), de (German), es (Spanish), pt (Portuguese)
  • ru (Russian), ar (Arabic), hi (Hindi), th (Thai)

Example: Immediate speak

User: "Say hello in Chinese" → music_play {"url":"https://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&tl=zh-CN&q=你好","autostart":true}

Example: Scheduled voice reminder

User: "Remind me to drink water in 30 minutes"

  1. get_current_time for current epoch
  2. Calculate trigger time = now + 1800
  3. cron_add with:

Limitations

  • Requires internet access (Google Translate)
  • Max ~200 characters per request
  • Audio quality is basic (not natural-sounding like Volcengine TTS)
  • No SSML or prosody control
  • If Volcengine TTS is configured, prefer the native voice channel instead