reddit-video-bot/src/voice_gen.py

15 lines
387 B
Python
Raw Normal View History

import asyncio
import edge_tts
VOICE = "en-US-ChristopherNeural"
async def _synthesize(text: str, output_path: str):
communicate = edge_tts.Communicate(text, VOICE)
await communicate.save(output_path)
def generate_audio(text: str, output_path: str):
"""Generate an MP3 from text using Edge TTS and save to output_path."""
asyncio.run(_synthesize(text, output_path))