-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtts.py
28 lines (18 loc) · 767 Bytes
/
tts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
"""
Basic example of edge_tts usage.
"""
import asyncio
import edge_tts
from config import VOICE
TEXT = """
Fashion and Food: A Lean and Healthy Lifestyle
The world of fashion and food is filled with deep-pocketed designers and restaurateurs who create culinary and sartorial experiences that cater to the affluent. However, the recent trend towards health consciousness has led to a shift in the industry. Today, lean is in, and flounces are out.
"""
OUTPUT_FILE = "test.mp3"
async def gen_tts_audio(text: str, filename: str) -> None:
"""Main function"""
communicate = edge_tts.Communicate(text, VOICE)
await communicate.save(filename)
if __name__ == "__main__":
asyncio.run(gen_tts_audio(TEXT, OUTPUT_FILE))