reddit-video-bot/src/voice_gen.py

14 lines
372 B
Python
Raw Normal View History

import asyncio
import os
import edge_tts
async def _synthesize(text: str, output_path: str, voice: str):
communicate = edge_tts.Communicate(text, voice)
await communicate.save(output_path)
def generate_audio(text: str, output_path: str):
voice = os.environ.get("BOT_VOICE", "en-US-ChristopherNeural")
asyncio.run(_synthesize(text, output_path, voice))