15 lines
387 B
Python
15 lines
387 B
Python
|
|
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))
|