Created
October 24, 2023 14:13
-
-
Save lewangdev/b28f42f2f672245419b9f52d7c525c17 to your computer and use it in GitHub Desktop.
Get Edge TTS Voice Name List
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from edge_tts import list_voices | |
async def print_voices() -> None: | |
"""Print all available voices.""" | |
voices = await list_voices() | |
voices = sorted(voices, key=lambda voice: voice["ShortName"]) | |
print("| Name | Gender | Language |") | |
print("| :--- | :----- | :--------|") | |
for idx, voice in enumerate(voices): | |
if idx != 0: | |
pass | |
cols = None | |
for key in voice.keys(): | |
if key in ( | |
"SuggestedCodec", | |
"FriendlyName", | |
"Status", | |
"VoiceTag", | |
"Name", | |
"Locale", | |
): | |
continue | |
pretty_key_name = key if key != "ShortName" else "Name" | |
if pretty_key_name == 'Name': | |
cols = [] | |
cols.append(voice[key]) | |
if pretty_key_name == 'Gender': | |
print(f"| {cols[0]} | {cols[1]} | {'-'.join(cols[0].split('-')[0:2])} |") | |
if __name__ == "__main__": | |
asyncio.run(print_voices()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment