edge-tts in Practice: Give Your Content Site a Voice — Free TTS for Production
edge-tts in Practice: Give Your Content Site a Voice Using free edge-tts to add audio functionality to a content site — SFD Lab practical tutorial including …
- Added to the lab
- Downloads
- 0
- Human review
- Human reviewed
edge-tts in Practice: Give Your Content Site a Voice
Using free edge-tts to add audio functionality to a content site — SFD Lab practical tutorial including multilingual support, batch generation pipeline, pitfall notes, and comparison with openai-tts.
The Use Case
SFD Lab runs smallfiredragon.com, a content site with articles in three languages (zh-CN, en, zh-TW). We wanted to add audio versions of articles — but at scale, paying per-character TTS adds up quickly.
edge-tts runs free on our servers and covers all three languages with natural-sounding voices.
The Stack
- edge-tts (Microsoft Neural TTS via Edge browser API)
- OpenClaw with the edge-tts skill installed
- A simple cron job to auto-generate audio when articles are published
Installation
clawhub install edge-tts
pip install edge-tts # Python library also required for batch generation
Batch Generation Pipeline
import asyncio
import edge_tts
async def generate_article_audio(text, locale, output_path):
voice_map = {
'zh-CN': 'zh-CN-XiaoxiaoNeural',
'en': 'en-US-JennyNeural',
'zh-TW': 'zh-TW-HsiaoChenNeural'
}
voice = voice_map.get(locale, 'zh-CN-XiaoxiaoNeural')
communicate = edge_tts.Communicate(text, voice)
await communicate.save(output_path)
# Generate for all three locales
async def main():
tasks = [
generate_article_audio(zh_text, 'zh-CN', 'article_zh.mp3'),
generate_article_audio(en_text, 'en', 'article_en.mp3'),
generate_article_audio(tw_text, 'zh-TW', 'article_tw.mp3'),
]
await asyncio.gather(*tasks)
asyncio.run(main())
Voice Quality Comparison
| Provider | Quality | Cost | Languages | Latency |
|---|---|---|---|---|
| edge-tts | Good | Free | 74 | Medium |
| openai-tts | Excellent | $15/M chars | Limited | Fast |
| Google TTS | Excellent | $4/M chars | 220+ | Fast |
For a content site where audio is a supplementary feature (not the primary product), edge-tts quality is entirely sufficient. We'd switch to openai-tts only if edge-tts became unavailable.
Production Pitfalls
Microsoft rate limiting: In batch mode, Microsoft will rate-limit if you fire too many concurrent requests. Add delays between requests: 2-3 seconds between each generation.
Long article chunking: Articles over 3000 characters need to be split into paragraphs, generated separately, and stitched together with ffmpeg. We built a simple chunking function that splits on paragraph breaks.
Voice consistency: If you regenerate part of an article, make sure to use the same voice ID. Mixing voices mid-article is jarring.
Caching strategy: Generate audio once and cache it. Re-generating on every page load would hit rate limits fast.
The OpenClaw Integration
With the edge-tts skill installed in OpenClaw, you can trigger audio generation conversationally:
Generate audio for this article in English using en-US-JennyNeural
[paste article text]
The skill handles chunking, generation, and returns the audio file path. Useful for one-off generation or when you want to preview a specific voice before committing to batch generation.
Summary
edge-tts is the right choice for any content site that wants audio without paying per-character. Zero cost, reasonable quality, 74 languages. The only investment is the setup time for a proper batch generation pipeline.
SFD Lab | edge-tts production deployment notes